我想在可扩展列表视图中添加图像图标.我已经看到他们仅在子元素中添加的教程.是否有任何其他方式在父母中添加图像图标任何帮助将不胜感激.提前致谢.
Joh*_*ube 13
您还可以在XML中定义自己的groupIndicator:
首先定义自己的drawable(我称之为list_view_group_indicator.xml并将其放在drawable目录中)
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_expanded="true"
android:drawable="@drawable/packagexgeneric" />
<item
android:drawable="@drawable/packagexgenericclose" />
</selector>
Run Code Online (Sandbox Code Playgroud)
然后将其用作expandableListview的drawable
<ExpandableListView android:id="@+id/server_show_list"
android:layout_width="fill_parent"android:layout_height="wrap_content"
android:groupIndicator="@drawable/list_view_group_indicator" />
Run Code Online (Sandbox Code Playgroud)