[solved]linearlayout left-center-right buttons

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

[solved]linearlayout left-center-right buttons

Postby qlimax » Tue Oct 20, 2009 11:01 pm

hi all...

it's possible to make a layout like this?
Image


i mean, WITH ONLY A LINEAR LAYOUT and WITHOUT PADDINGS tricks, having a Button on the left one in the center and one on the right? it's possible with the gravity attributes only? (sorry for the crappy img)


thanks :)
Last edited by qlimax on Fri Oct 23, 2009 12:43 pm, edited 1 time in total.
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Top

Re: linearlayout left-center-right buttons

Postby jagtap.jj1 » Fri Oct 23, 2009 7:00 am

Surely Here is code to achieve this



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/button1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Left"
/>
<Button android:id="@+id/button2"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Center"
/>
<Button android:id="@+id/button3"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Right"
/>
</LinearLayout>
</LinearLayout>



qlimax wrote:hi all...

it's possible to make a layout like this?
Image


i mean, WITH ONLY A LINEAR LAYOUT and WITHOUT PADDINGS tricks, having a Button on the left one in the center and one on the right? it's possible with the gravity attributes only? (sorry for the crappy img)


thanks :)
java-android developer
User avatar
jagtap.jj1
Senior Developer
Senior Developer
 
Posts: 124
Joined: Fri Aug 22, 2008 11:52 am
Location: India(Mumbai)

Postby qlimax » Fri Oct 23, 2009 10:58 am

thank you !!!

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. android:layout_weight="1"
Parsed in 0.000 seconds, using GeSHi 1.0.8.4

reference
nice to know :)


thx for the xml, I adapted it a little bit (some more things that 3 buttons) and the result work as expected.


see you.
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests