How to align Relative layout in Linear layout to bottom?

1.1k Views Asked by At

I have the following Relative layout which is containing 2 button.

I would like to ask how can i align Relative layout to bottom?

Relative Layout has as a parent Linear layout.

<!-- GROUPED BUTTONS EDIT/CLEAR ALL-->
        <RelativeLayout
            android:id="@+id/group_button_layout_edit_clear"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_alignParentBottom="true"
            android:gravity="bottom">

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="bottom"
                android:orientation="horizontal"
                android:weightSum="2">

                <Button
                    android:id="@+id/group_button_edit"
                    android:layout_width="0dip"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:layout_alignParentLeft="true"
                    android:layout_weight="1"
                    android:background="@color/grayBg"
                    android:text="@string/clear"
                    android:textColor="@color/colorPrimary"
                    android:textSize="10sp"/>

                <Button
                    android:id="@+id/group_button_clear"
                    android:layout_width="0dip"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:layout_alignParentRight="true"
                    android:layout_weight="1"
                    android:background="@color/grayBg"
                    android:text="@string/edit"
                    android:textColor="@color/colorPrimary"
                    android:textSize="10sp"/>

            </LinearLayout>
        </RelativeLayout>
        <!-- //GROUPED BUTTONS EDIT/CLEAR ALL-->

Many thanks for any advice.

1

There are 1 best solutions below

6
On BEST ANSWER

In the external LinearLayout add this:

android:orientation="vertical"
android:gravity="bottom"

This will make the contained RelativeLayout move to the bottom.