hcg_21 2012-10-23 02:22 采纳率: 0%
浏览 5162
已采纳

当列表视图是空的时,如何显示空视图?

以下是我设计的布局:
不知道什么原因,即使列表都不是空的,但是视图(在这个案例中是TextView)总是出现空视图。我以为列表会自动检测到什么时候显示空视图。
如何正确检测空视图呢?

elativeLayout android:id="@+id/LinearLayoutAR"
            android:layout_height="fill_parent" android:layout_width="fill_parent">
            <ListView android:layout_width="fill_parent"
                android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/ARListView"></ListView>
            <ProgressBar android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:id="@+id/arProgressBar"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"></ProgressBar>
            <!-- Here is the view to show if the list is emtpy -->
            <TextView android:id="@id/android:empty" android:layout_width="match_parent"
        android:layout_height="match_parent" android:text="No Results" />
        </RelativeLayout>
  • 写回答

2条回答 默认 最新

  • xiaoyan_12 2012-10-23 05:31
    关注

    应该是:

    <TextView android:id="@android:id/empty" android:layout_width="match_parent"
                android:layout_height="match_parent" android:text="No Results" />
    

    注意id的属性

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!