Android(安卓)处理空列表的方法(必看篇)
16lz
2021-01-24
android中ListView 用来展示数据,如果列表为空的状态,可以通过setEmpty(View)方法设置为空时显示的内容。
布局xml
代码:
public class Hack24Activity extends Activity { private ListView mListView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_hack24); mListView = (ListView) findViewById(R.id.my_list_view); mListView.setEmptyView(findViewById(R.id.empty_view)); }}
以上这篇Android 处理空列表的方法(必看篇)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。
更多相关文章
- android当方法数超过64k时(android studio)
- android CursorAdapter的监听事件
- Android菜单的几种方法
- Android注解式绑定控件
- 从源代码编译Android(CyanogenMod For Hero GSM)【转】
- android重新启动应用程序和重新启动系统
- Android(安卓)adb shell启动应用程序的方法
- SDK1.5下 android判断是否存在网络
- android UEventObserver的用法