I was trying to have a footer below my listview.
This is how m doing.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:orientation="vertical" >
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:divider="#BE6D79"
android:dividerHeight="3dp" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:background="@color/darkDetna"
android:orientation="horizontal" >
<Button
android:id="@+id/contactBtn"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:paddingRight="0dip"
android:text="Contact" />
<Button
android:id="@+id/faq"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:padding="0dip"
android:text="Terms And Conditions" />
<Button
android:id="@+id/feedback"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:padding="0dip"
android:text="Feedback " />
<Button
android:id="@+id/fullSIte"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:padding="0dip"
android:text="Full Site" />
</LinearLayout>
</LinearLayout>
here
but the problem is the list content is small or there is only one list item the footer ll be below the list view.
I want the footer to be fixed to the bottom of the screen.
Thanks in advance for you time and help.
Better use RelativeLayout
Explain the implementation:
android:layout_alignParentBottom="true"
android:layout_above="@+id/LinearLayout1"
android:layout_width="fill_parent"
and
android:layout_height="fill_parent"
Change at your code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:orientation="vertical" >
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/LinearLayout1"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_weight="1"
android:divider="#BE6D79"
android:dividerHeight="3dp" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@color/darkDetna"
android:orientation="horizontal" >
<Button
android:id="@+id/contactBtn"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:paddingRight="0dip"
android:text="Contact" />
<Button
android:id="@+id/faq"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:padding="0dip"
android:text="Terms And Conditions" />
<Button
android:id="@+id/feedback"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:padding="0dip"
android:text="Feedback " />
<Button
android:id="@+id/fullSIte"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:padding="0dip"
android:text="Full Site" />
</LinearLayout>
</RelativeLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With