1

我有一个活动,我有一个列表视图。在列表视图的顶部,我包括另一个布局活动,其中包含两个用于过滤列表视图的微调器。但是,如果我包含过滤器,则列表视图不起作用。它没有人满为患。如果我删除它,列表视图将被填充。

<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" >

    <include android:id="@+id/filter" layout="@layout/activity_expense_list_filter" />

    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"        
        android:layout_alignParentLeft="true"
        android:layout_below="@id/filter"
        android:layout_marginTop="23dp"
        android:drawSelectorOnTop="false">                
    </ListView>

</RelativeLayout>

如果我删除过滤器视图,则列表视图按预期工作。任何想法我如何解决这个问题

4

2 回答 2

0

我发现问题是因为我在其他布局中添加了宽度和高度作为 match_parent。所以它位于列表视图的顶部,它占据了整个宽度和高度,从视图中隐藏了列表视图。我将它设置为 wrap_content 并修复它。

于 2012-12-19T06:59:35.110 回答
0

布局是为了activity_expense_list_filter.xml什么?它是否还包含一个也称为 的元素@android:id/list

编辑:

我有一种感觉,它的标题是“过滤器”,包含的布局完全掩盖了您的列表。不透明度是100%吗?

于 2012-12-19T06:05:27.927 回答