具有固定页脚的TouchListview

时间:2011-09-11 18:00:24

标签: android layout footer commonsware-cwac

我的问题应该在这里回答:Fixed footer not displaying the bottom-most list item

但它对我不起作用。

我想要一个底部有固定页脚的列表视图。目前,listview与窗口一样大,这使得页脚重叠。 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>

虽然我使用Commonsware的touchlistview,但这不应该是它不起作用的原因,我想。谁能发现错误?

另外,我看不到我实现的分隔符。当我使用background或src属性时,都看不到任何效果。

1 个答案:

答案 0 :(得分:0)

首先,尽可能在诊断问题时回退到更简单的小部件。如果您看到TouchListView的奇怪现象,请尝试常规ListView

其次,TouchListView的布局规则很奇怪。您正在尝试将窗口小部件放在自己的容器下面。并且,您应该使用0dp作为高度。

尝试那些东西。如果问题仍然存在并且TouchListView是唯一的,我将需要一个示例项目来重现错误以进一步调查。如果常规ListView出现问题,并且我在此处写的内容没有帮助,则下一步是使用层次结构视图来尝试诊断布局的错误。

相关问题