Android中替换ExpandableListView控件前面的箭头图标
Android中替换ExpandableListView控件前面的箭头图标
首先,自定义一个expandablelistviewselector.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/expandablelistviewindicatordown" />
<item android:drawable="@drawable/expandablelistviewindicator" />
</selector>
其次,在程序的主体部分编写类似如下的代码:
expandList.setGroupIndicator(this.getResources().getDrawable(R.layout.expandablelistviewselector));