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条)

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作