Search code examples
androidandroid-layoutandroid-relativelayoutandroid-linearlayout

How to place a Linearlayout at bottom inside a Relativelayout in android


I need to place a linear layout at bottom inside a relativelayout which is the top most parent in xml. How can i do this?

Please help me.

 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:orientation="vertical" >
<RelativeLayout .......   <<--- this should occupy total available space
</Relativelayout
 <Linearlayout .......     <<-- this should place at bottom always with height 50dp
 </LineaLayout>
 </ReltiveLayout>

Solution

  • Please try this:

    <LinearLayout android:layout_alignParentBottom="true" android:layout_height="50dp" android:layout_width="wrap_content">
    </LinearLayout>
    

    you can align at bottom in xml from the above attribute.