ExpandableListView 箭头样式

ExpandableListVivew是ListView的子类,它在普通ListView的基础上进行了扩展,它把应用中的列表项分为几组,每组里 又可包含多个列表项。ExpandableListVivew的用法与普通ListView的用法非常相似,只是ExpandableListVivew 显示的列表项应该由ExpandableAdapter提供。

下图为ExpandableListVivew支持的xml属性

XML Attributes

属性名

Related Method

描述

                 

android:childDivider

指定各组内子类表项之间的分隔条 ①

                 

android:childIndicator

显示在子列表旁边的Drawable对象②

                 

android:childIndicatorLeft

子列表项指示符的左边约束位置③

                 

android:childIndicatorRight

子列表项指示符的右边约束位置④

                 

android:groupIndicator

显示在组列表旁边的Drawable对象⑤

                 

android:indicatorLeft

组列表项指示器的左边约束位置⑥

                 

android:indicatorRight

组列表项指示器的右边约束位置 ⑦

                 

备注:

①   注:图片不会完全显示,分离子列表项的是一条直线

②   注:可以是一个图片

③ 注:即从左端0位置开始计数,比如,假设指示符是一个图标,给定这个属性值为

3dip,则表示从左端起3dip开始显示此图标。

④   注:表示右端到什么位置结束

⑤   注:可以是一个图片。

⑥   注:表示左端从什么位置开始。

⑦ 注:表示右端到什么位置结束。

1)定义xml文件先,命名为expand_list_indicator.xml

注意事项:因为indicator背景图片会自动拉伸,如果不想图片被拉伸的话,那么就对indicator_open ,indicator_close图片做特殊处理,做成.9.png格式就可以了。或者使用另外一个方法
android:groupIndicator=”@null”这里非常重要,禁用系统自带的图标
再在group的xml中设置ImageView,这个简单,然后在适配器的getGroupView中加入图片变换的效果:

原文地址:https://www.cnblogs.com/spring87/p/4525600.html