ExpandableListView的小图标有个状态,一个是不点击的情况,一个是点击后展开的情况,用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/narrow_select" />
<item android:drawable="@drawable/narrow" />
</selector>
Java的代码如下:
ExpandableListView listView = getExpandableListView();
listView.setGroupIndicator(this.getResources().getDrawable(R.drawable.group_icon_selector));