先在drawable目录下建立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/up_indicator" /> <item android:state_expanded="false" android:drawable="@drawable/down_indicator" /> </selector>
up_indicator和down_indicator即为你要替换的图标文件名。
然后修改Activity代码中的ExpandableListView设置代码,关键一句是:
setGroupIndicator(this.getResources().getDrawable(R.drawable.expandablelistview_indicator));
时间: 2024-12-19 19:45:21