ExpandableListView的使用和扩展

示例演示:


1. 系统自带的ExpandableListView使用:

  分为GroupView 和ChildView 数据存储结构示例:List<String> ,Map<String ,List<String>>  

  取消系统自带箭头 可在子项中 加入全部这样字段

  自定义适配器,继承BaseExpandableListAdapter  类似ListView的 BaseAdapter .在infalte GroupView 时可放个自定义图标在右侧  在onGroupExpanded 设置点击未展开父项收回当前展开父项

  设置setOnChildClickListener ,监听点击子项

2 GitHub 上 AnimateExpandableListView使用:

地址:点击打开链接

类似系统自带的ExpandableListView  两个关键方法 expandGroupWithAnimation collapseGroupWithAnimation  可在setOnGroupClickListener调用、

自定义适配器 继承AnimatedExpandableListAdapter ,与BaseExpandableListAdapter的区别 就是getRealChildCount() getRealChildView().

2 GitHub 上ExpandableLayout 使用:

地址:点击打开链接

区别是 展开项 可以是任意layout 不局限于列表)

ExpandableLayoutItem 类似ListView 中的Item 不过属性中包含headlayout contentayout


示例代码下载地址:点击打开链接

猜你喜欢

转载自blog.csdn.net/hxz6688/article/details/50704686