Android 朝花夕拾: ListActivity

ListActivity: 

    google新增的widget. 默认情况下,它的layout里面只有一个ListView,且居中填满parent. 

    使用它时,如果需要自定义layout, 则在layout中,必须要有ListView且 ID 为系统ID; @id/android:list

    如果配合 一个TextView使用,把他们放在同一个LinearLayout中,且TextView的ID为系统的:@id/android:empty ;当list中item个数为0的时候, 则显示TextView的内容.(例如显示:没有数据);

     

  1 <?xml version="1.0" encoding="utf-8"?>

 2  < LinearLayout
 3     xmlns:android ="http://schemas.android.com/apk/res/android"
 4    android:layout_width ="match_parent"
 5    android:layout_height ="match_parent" >
 6    
 7     < ListView  android:layout_width ="fill_parent"  
 8      android:layout_height ="fill_parent"  
 9      android:id ="@id/android:list"
10       ></ ListView >
11      
12       < TextView   android:layout_width ="fill_parent"  
13      android:layout_height ="fill_parent"  
14      android:text ="@string/data_empty"
15      android:id ="@id/android:empty" ></ TextView >
16  </ LinearLayout >

 

转载于:https://www.cnblogs.com/newstory/archive/2011/02/23/1962459.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值