How to set content in a Linear layout to the BOTTOM of the Screen in Android.? -


see following xml code

<?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="wrap_content" >      <linearlayout         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:orientation="vertical" >          <include layout="@layout/header" />          <textview             android:layout_width="fill_parent"             android:layout_height="18dp" />          <linearlayout             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:background="@drawable/header"             android:orientation="horizontal" >              <imageview                 android:layout_width="50dp"                 android:layout_height="50dp"                 android:src="@drawable/calendar" />              <textview                 android:id="@+id/tvtitle"                 android:layout_width="fill_parent"                 android:layout_height="50dp"                 android:gravity="center"                 android:text="@string/calendar"                 android:textcolor="#ffffffff"                 android:textsize="18sp" />         </linearlayout>          <linearlayout             android:id="@+id/mylayout"             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:orientation="vertical" >           </linearlayout>         <!-- <include layout="@layout/footer"/> -->          <linearlayout              android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_gravity="bottom"             android:background="@drawable/datename_bottom_bg"             android:orientation="horizontal">               <textview                 android:id="@+id/upgrade_4"                 android:layout_width="50dp"                 android:layout_height="50dp"                 android:layout_weight="1"                 android:drawabletop="@drawable/upgrade"                 android:gravity="center"                 android:text="@string/upgrade"                 android:textsize="8sp" />              <textview                 android:id="@+id/panchang_4"                 android:layout_width="50dp"                 android:layout_height="50dp"                 android:layout_weight="1"                 android:drawabletop="@drawable/kalash_bottom"                 android:gravity="center"                 android:text="@string/panchang"                 android:textsize="8sp" />              <textview                 android:id="@+id/time_range_4"                 android:layout_width="50dp"                 android:layout_height="50dp"                 android:layout_weight="1"                 android:drawabletop="@drawable/timer_bottom"                 android:gravity="center"                 android:text="@string/timespan"                 android:textsize="8sp" />              <textview                 android:id="@+id/reminder_4"                 android:layout_width="50dp"                 android:layout_height="50dp"                 android:layout_weight="1"                 android:drawabletop="@drawable/reminder_bottom"                 android:gravity="center"                 android:text="@string/reminders"                 android:textsize="8sp" />             <!--          <textview android:id="@+id/calendar_4" android:layout_width="50dp" android:layout_height="50dp" android:drawabletop="@drawable/calendar_bottom"          android:text="@string/calendar" android:textsize="8sp" android:gravity="center" android:layout_weight="1"/>             -->         </linearlayout >     </linearlayout>  </scrollview> 

what looks on left , want on right, tried replacing linearlayout relativelaout still not working. please help.! actualexpected

you should use relativelayout, example

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent" >      <scrollview          android:layout_width="match_parent"         android:layout_height="match_parent"         android:background="#ffff0000"         android:layout_above="@+id/bottom_panel">      </scrollview>      <linearlayout          android:id="@+id/bottom_panel"         android:orientation="horizontal"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true">          <button              android:layout_width="0dip"             android:layout_weight="1"             android:layout_height="wrap_content"             android:text="button 1"/>          <button              android:layout_width="0dip"             android:layout_weight="1"             android:layout_height="wrap_content"             android:text="button 2"/>          <button              android:layout_width="0dip"             android:layout_weight="1"             android:layout_height="wrap_content"             android:text="button 3"/>          <button              android:layout_width="0dip"             android:layout_weight="1"             android:layout_height="wrap_content"             android:text="button 4"/>     </linearlayout>  </relativelayout> 

this give similar. place widgets instead of buttons. enter image description here


Comments