I would like to add a footer view, a counter of the elements loaded in a list view. I would like to know where sholuld i put the footer view. I've already one in my listview and i suppose that i must not put it there because i want it vissible all the time, not when i get to the bottom of it like the one i have.
Code:
ListView:
<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/lista"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stackFromBottom="false"
android:transcriptMode="normal"
/>
</LinearLayout>
Code of the tabs:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainTabActivity" >
<TabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|fill_vertical|fill_horizontal" >
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/tab1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/lista"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stackFromBottom="false"
android:transcriptMode="normal"
/>
</LinearLayout>
<LinearLayout
android:id="b"
</LinearLayout>
<LinearLayout
android:id="c"
</LinearLayout>
<LinearLayout
android:id="d"
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
I have this: http://imageshack.us/photo/my-images/23/6a3t.jpg/
And i would like this: http://imageshack.us/photo/my-images/809/kesm.jpg/
If you put the FrameLayout with match_parent width and height inside a LinearLayout all the content will hide out of the screen.
There are 2 forms to add that footer:
First, set the framelayout with this sizes:
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
Two, use a RelativeLayout and set all content bellow others and add the footer with layout_alignParentBottom = true if you want to add the footer above the content or bellow the last view if you want that the footer be with the content.