Reputation: 73484
Linear layout below. This layout is aligned parent bottom in a Relative Layout. Problem is I want all buttons to have the same height. I have tried layout_gravity="fill" but that doesn't seem to work.
<LinearLayout android:id="@+id/button_layout"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:background="#FFFFFF"
android:layout_alignParentBottom="true">
<Button android:text="Send" android:id="@+id/send_button"
android:layout_weight="1" android:layout_gravity="fill"
android:layout_width="0dip" android:layout_height="wrap_content">
</Button>
<Button android:text="Report Missing Image" android:id="@+id/report_button"
android:layout_weight="1"
android:layout_width="0dip" android:layout_height="wrap_content">
</Button>
<Button android:text="Close" android:id="@+id/close_button"
android:layout_weight="1" android:layout_gravity="fill"
android:layout_width="0dip" android:layout_height="wrap_content">
</Button>
</LinearLayout>
Upvotes: 2
Views: 3636
Reputation: 1666
For the Buttons in the same layout set the following:
android:layout_weight="1"
android:layout_height="fill_parent"
that way, the Button will have equal right to fill the parent layout's height so their heights will be the same size.
Upvotes: 4
Reputation: 12782
You should specify the android:layout_weightsum parameter for LinearLayout with value 3. And for Buttons, the layout_weight as 1.
You don't need to specify the gravity.
Upvotes: 1
Reputation: 46844
Try setting the layout_height on the buttons to fill_parent. This will cause them to all take up the amount of space in the parent.
Upvotes: 3