Chinaunix首页 | 论坛 | 博客

fx

  • 博客访问: 1346298
  • 博文数量: 115
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 3964
  • 用 户 组: 普通用户
  • 注册时间: 2013-05-02 14:36
文章分类
文章存档

2022年(2)

2019年(2)

2018年(10)

2017年(1)

2016年(50)

2015年(12)

2014年(9)

2013年(29)

分类: Android平台

2016-02-03 10:31:54


继承了 ListActivity 时 ,直接在布局文件中添加

<ListView
    
android:id="@android:id/list"
    android:layout_width
="match_parent"
    android:layout_height
="match_parent" />


<TextView
    
android:id="@android:id/empty"
    android:layout_width
="match_parent"
    android:layout_height
="match_parent"
    android:gravity
="center"
    android:text
="No items." />

没有继承时,在代码中设置数据为空时的view
 mListView = (ListView) findViewById(R.id.List);
 mListView.setEmptyView(findViewById(R.id.emptyView));

阅读(2661) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~