首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >当ListView为空时显示空视图

当ListView为空时显示空视图
EN

Stack Overflow用户
提问于 2010-09-23 00:40:11
回答 9查看 163K关注 0票数 139

由于某些原因,即使ListView不为空,空视图(在本例中为TextView )也会始终出现。我认为ListView会自动检测何时显示空视图。

代码语言:javascript
复制
<RelativeLayout android:id="@+id/LinearLayoutAR"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent">
    <ListView android:id="@+id/ARListView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"></ListView>
    <ProgressBar android:id="@+id/arProgressBar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        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>

如何正确地连接空视图?

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3771568

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档