Hi im trying to create an sticky footer that will show in every activity in my application, i already have the header i used windows feautre custom titlebar to achieve this so my header always shows in all my activities.
I have:
- Activity with listview using lazyadapter to get data from xml file.
- Activity with basic audio player.
i want to create a sticky footer si i t always shows not only when i scroll at the bottom of listview something like this:

i already have this:
footer.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:text="Footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"/>
</LinearLayout>
and in my listview activity i used:
View footerView = ((LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.footer, null, false);
list.addFooterView(footerView);
the footer shows but just if i scroll to the end of listview isnt sticky, which method i could use to create that sticky footer?
thanks.
edit:
main.xml
<?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:orientation="vertical">
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#b5b5b5"
android:dividerHeight="1dp"
android:fadingEdge="none"
android:listSelector="@drawable/list_selector" />
</LinearLayout>
list_row.xml:
<?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="wrap_content"
android:background="@drawable/list_selector"
android:orientation="horizontal"
android:padding="5dip" >
<!-- ListRow Left sied Thumbnail image -->
<LinearLayout android:id="@+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dip"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip">
<!-- android:background="@drawable/image_bg" -->
<ImageView
android:id="@+id/miniatura"
android:layout_width="80dip"
android:layout_height="50dip"
android:src="@drawable/rihanna"/>
</LinearLayout>
<!-- Title Of Song-->
<TextView
android:id="@+id/nombre"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/thumbnail"
android:layout_marginTop="8dp"
android:layout_toRightOf="@+id/thumbnail"
android:text="Rihanna Love the way lie"
android:textColor="#040404"
android:textSize="15dip"
android:textStyle="bold"
android:typeface="sans" />
<!-- Artist Name -->
<TextView
android:id="@+id/web"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/nombre"
android:textColor="#343434"
android:textSize="10dip"
android:layout_marginTop="1dip"
android:layout_toRightOf="@+id/thumbnail"
android:text="Just gona stand there and ..." />
<!-- Rightend Duration -->
<TextView
android:id="@+id/shoutcast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/nombre"
android:layout_marginRight="5dip"
android:gravity="right"
android:text="5:45"
android:textColor="#10bcc9"
android:textSize="10dip"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/shoutcast"
android:layout_marginRight="5dip"
android:gravity="right"
android:text="5:45"
android:textColor="#10bcc9"
android:textSize="10dip"
android:textStyle="bold"
android:visibility="gone" />
<!-- Rightend Arrow -->
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/arrow"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
You don’t want your footer to be in the list, because then it will only show up at the bottom of the list. Instead you want it to be another level up, inside the root element. The header and footer height should be set to wrap content so they only take up as much space as they need, and the list should be set to height=0dp weight=1 so that it takes up all the rest of the available space. Have a look at this replacement I’m providing for main.xml. You should work with your footer in the .xml layout file (if possible) and try to avoid doing it in the code.
Main:
Footer: