[应用代码] pinned-section-listview

介绍
安卓2.1及更高版本中使用ListView十分方便。固定部分是header视图,当所有项目均不可见时处于列表的顶端。
  

特性
这个列表实现了许多其他实现所缺少的功能。包括:
1.快速滚动  
2.页眉和页脚  
3.可供点击的固定部分
除此之外它不会创建任何多余视图和布局,极其简洁。

用法  
1、在layout.xml 文件中用com.hb.views.PinnedSectionListView代替标准ListView。
  1. <font size="3"><com.hb.views.PinnedSectionListView
  2.       android:id="@android:id/list"
  3.       android:layout_width="match_parent"
  4.       android:layout_height="wrap_content" 
  5.       /></font>
复制代码
2、扩展ListAdapter以实现PinnedSectionListAdapter接口。此时需要添加单独isItemViewTypePinned(int viewType)方法,该方法必须为所有固定视图类型返回true。
  1. <font size="3">// Our adapter class implements 'PinnedSectionListAdapter' interface
  2.   class MyPinnedSectionListAdapter extends BaseAdapter 
  3.           implements PinnedSectionListAdapter {

  4.       ...

  5.       // We implement this method to return 'true' for all view types we want to pin
  6.       @Override
  7.       public boolean isItemViewTypePinned(int viewType) {
  8.           return viewType == <type to be pinned>;
  9.       }
  10.   }</font>
复制代码
详细见代码:  pinned-section-listview-master.zip (494.15 KB, 下载次数: 1)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值