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

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

1 编写groupindicator_selector.xml如下:

<?xml version="1.0" encoding="utf-8"?>   
<selector xmlns:andro>   
    <item android:state_expanded="true" android:drawable="@drawable/right" />   
    <item android:drawable="@drawable/down" />   
</selector> 

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

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

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