可展开列表组件ExpandableListView解析

本文介绍了在Android开发中如何使用ExpandableListView,重点讲解了通过继承BaseExpandableListAdapter的方法来实现该组件的用法。文章提到了xml布局中的关键属性如childDivider、childIndicator和groupIndicator,并详细解释了Adapter需要实现的关键方法,包括getGroupCount、getChildrenCount等,以及如何创建和绑定组及子项的View。
摘要由CSDN通过智能技术生成

开发Android项目的时候经常会用到ExpandableListView,它是ListView的子类,因此使用起来和ListView差不多,和其匹配的Adapter有BaseExpandableListAdapter,SimpleExpandableListAdapter和SimpleCursorTreeAdapter,这里,我只说明一下继承BaseExpandableListAdapter的用法,这种方法很灵活,而且难度不大。

在xml中,只要写上如下代码即可

<ExpandableListView 
        android:id="@+id/help_exp_listview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:groupIndicator="@null"
        >
</ExpandableListView>


有几个常用的属性

1.android:childDivider,指定各组内各子列表项之间的分割条

2.android:childIndicator,显示在子列表项旁边的Drawable对象

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值