It seems that there are a lot of questions about centering, about the same size, etc., but so far I have not found exactly my business, so I dare to ask :)
I need a layout of three buttons:
[ previous ][*select*] [ next ]
where the [previous] and [next] buttons are the same (that is, in this case the size is [previous] , since it is larger), and the [* select *] button must be stretched to occupy the entire available width.
Following the prompts for creating two buttons in a LinearLayout of the same size, I came up with the following XML file:
<LinearLayout android:id="@+id/button_bar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:orientation="horizontal" > <Button android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:text="Previous" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="2" android:text="Select" /> <Button android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:text="Next" /> </LinearLayout>
It almost works :) Except for one: instead of the Next button, to match the size of the Previous , the android makes the Previous button the size of Next :) And because of this, the text "Previous" is wrapped in two lines, for example
Previ ous
I donβt know if this is a mistake or not, but can you advise me on a workaround or some other way to achieve the desired layout?
Thank!
android layout android-linearlayout
dimsuz Aug 20 '10 at 10:52 2010-08-20 10:52
source share