您的位置:首页 > 其它

ExpandableListView

2016-05-04 21:31 393 查看
##本章目标

ExpandableListView 可展开的列表视图控件

##ExpandableListView的介绍

1、层级关系

AbsListView

ListView

ExpandableListView

GridView

2、特点

可以展示垂直滚动的二级列表,数据来自于ExpandableListAdapter

##ExpanadableListView的使用

1、找控件

findViewById

2、准备数据

String[] groups={};

String[][] names={{},{},{}};

3、设置适配器

BaseExpandableListAdapter

必须重写四个方法:

getGroupCount groups.length

getGroupView groups[]

getChildrenCount names[groupPosition].length

getChildView names[][]

4、设置监听

设置子级监听 onChildClickListener

默认不能点击,除非重写 isChildSelected方法
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: