茴香豆的第五种写法---设置ExpandableListView系统自带图标按下效果

1 编写groupindicator_selector.xml如下:

<?xml version="1.0" encoding="utf-8"?>   
<selector xmlns:android="http://schemas.android.com/apk/res/android">   
    <item android:state_expanded="true" android:drawable="@drawable/right" />   
    <item android:drawable="@drawable/down" />   
</selector> 

再次指定ExpandableListView展开和收缩时的不同图标

2 在布局文件中为<ExpandableListView指定groupIndicator

<ExpandableListView
        android:id="@+id/expandableListView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:groupIndicator="@drawable/groupindicator_selector"
    />



 

原文地址:https://www.cnblogs.com/pangblog/p/3327670.html