【Android应用界面编程】-----ExpendableListView

一、知识点

1、ExpandableListView是LIstView的子类,它在普通ListView的基础上进行了 扩展,它把应用的列表项分成了几组,每组又可包含多个列表项。
2、ExpandablelistView 的用法与普通的ListView的 用法相似,只是ExpandableListView所显示的列表项应该由ExpandableListAdapter提供,实现ExpandablelistAdaptery有如下三种常用方式:
  • 扩展BaseExpandableListAdapter实现ExpandableListAdapter
  • 使用SimpleExpandableListAdapter将两个List集合包装成ExpandableListAdapter
  • 使用SimpleExpandableListAdapter将Cursor中的数据包装成SimpleCursorTreeAdapter
3、调用BaseExpandableListAdapter需要重写的10个方法
  • public Object getChild(int groupPosition, int childPosition)
  • 获取指定组中的指定子元素数据。返回值,返回指定子元素数据。
  • public long getChildId(int groupPosition, int childPosition)
  • 获取指定组中的指定子元素ID,这个ID在组里一定是唯一的。
  • public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,ViewGroup parent) 
  • 获取一个视图对象,显示指定组中的指定子元素数据。
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值