Sandy Sandy - 5 months ago 11
Android Question

How to place Relative layout at bottom of screen(or linear layout).?

I have following in xml






I wanna put the second linear layout at the bottom of the screen.
How will i do?
I have set the property of second Relative layout to bottom but still not showing at bottom..

**

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<RelativeLayout android:id="@+id/RelativeLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</RelativeLayout>
<RelativeLayout android:id="@+id/RelativeLayout02"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</RelativeLayout>
<RelativeLayout android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_gravity="bottom">
</RelativeLayout>
</LinearLayout>


**
Thanx in advance

Answer

The Layout you want at the bottom should have:
android:gravity = "bottom"
and its parent should have:
android:layout_height="fill_parent"