0

My question should be answered here: Fixed footer not displaying the bottom-most list item

But it does not work for me.

I want a listview with a fixed footer at the bottom. At the moment, the listview is as large as the window, which makes the footer overlap. XML:

<?xml version="1.0" encoding="utf-8" ?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="fill_parent" 
android:layout_height="fill_parent"
android:orientation="vertical">

  <!-- <ImageView 
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:src="@drawable/baby_blue_solid" android:scaleType="centerCrop" />-->
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/footer_cloud"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:layout_alignParentBottom="true"
    >

    <ImageView android:id="@+id/add_icon"
        android:layout_centerInParent="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
                android:src="@drawable/ic_menu_add"
    />

    <ImageView android:id="@+id/cloudBG"
        android:layout_centerInParent="true"
        android:layout_width="230dp"
        android:layout_height="60dp"
        android:background="@drawable/cl"

    />

    <ImageView 
        android:id="@+id/footer_divider"
        android:layout_width="fill_parent"
        android:layout_height="2dp"
        android:background="@android:drawable/divider_horizontal_bright"
        android:layout_above="@id/cloudBG"
    />


    </RelativeLayout>

<com.commonsware.cwac.tlv.TouchListView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tlv="http://schemas.android.com/apk/res/com.commonsware.cwac.tlv.demo"

    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/root"
    android_layout_above="@id/footer_cloud"
    android:drawSelectorOnTop="false"
    android:listSelector="@android:color/transparent"

    tlv:normal_height="64dip"
    tlv:grabber="@+id/icon"
    tlv:remove_mode="slideLeft"

/>

</RelativeLayout>

Although Im using a touchlistview by Commonsware, that shouldn't be a reason why it wouldn't work, I think. Can anyone spot the mistake?

Also, I can't see the divider I implemented. Both when I use the background or src attribute, no effect is visible.

Community
  • 1
  • 1
Nino van Hooff
  • 3,677
  • 1
  • 36
  • 52
  • This site suggest a height of 0dp for the list: http://blog.maxaller.name/2010/05/attaching-a-sticky-headerfooter-to-an-android-listview/ For me that just makes the list invisible. It is filled bu an arrayadapter, by the way – Nino van Hooff Sep 11 '11 at 18:03

1 Answers1

0

First, fall back to a simpler widget when diagnosing problems whenever possible. If you are seeing oddities with TouchListView, try a regular ListView.

Second, your layout rules for the TouchListView are strange. You are trying to make the widget below its own container. And, you should be using 0dp for the height.

Try those things. If the problem is still occurring and is unique to TouchListView, I will need a sample project the reproduces the error to investigate further. If the problem occurs with regular ListView, and what I have written here has not helped, your next step is to use Hierarchy View to try to diagnose what is wrong with your layout.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks for the suggestion. I changed list height to 0dp, replaced touchlistview with listview. After nothing changed, I tried the hierarchyviewer. I noticed 3 children of id/root: the list, the footer and the background imageview. I suspected the background might be the problem, so I removed it, but no effect. Root now has two children. Footer has alignparentbottom and list has above:footer – Nino van Hooff Sep 19 '11 at 21:01