如何显示邮件时列表视图采用的是Android空 [英] How to display a message when the list view is empty in android

查看:111
本文介绍了如何显示邮件时列表视图采用的是Android空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个新到Android的东西。我创建包含将获得动态填充列表视图的应用程序。我的要求是,当该列表是空的,我想显示的消息。我不想只是为了显示此消息创建其他的视图。有没有什么好的办法做到这一点?有什么建议?

I am a new to Android stuff. I am creating an application that contains a list view that will get dynamically populated. My requirement is when the list is empty, I would like to show a message. I don't want to create additional views just for displaying this message. Is there any nice way to do this? Any suggestions?

推荐答案

ListActivity 有一个功能,它显示了一个特定视图时,列表是空的: @android:ID /空。您可以轻松地只使用一个自定义布局与 ListActivity 来实现这一目标。

ListActivity has a feature where it shows a specific view when the list is empty: @android:id/empty. You can easily just use a custom layout with ListActivity to achieve this.

如果你不想使用 ListActivity 你总是可以看看<一实施href=\"http://www.google.com/$c$csearch/p?hl=en#uX1GffpyOZk/core/java/android/app/ListActivity.java&q=listactivity.java&sa=N&cd=1&ct=rc\">ListView.java并适应这一点。

If you don't want to use ListActivity you can always look at the implementation of ListView.java and adapt that.

这篇关于如何显示邮件时列表视图采用的是Android空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆