我希望能够完全隐藏自定义ExpandableListView中的groupIndicator。
这里提供的示例在这里似乎没有起作用。
它建议创建一个选择器并使用expList.setGroupIndicator(selector),我进行了复制:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/empty_icon">
<item android:state_empty="true" android:drawable="@android:color/transparent"/>
<item android:state_expanded="true" android:drawable="@android:color/transparent" />
<item android:drawable="@android:color/transparent" />
</selector>
这会导致以下错误
ERROR/AndroidRuntime(10675): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x12/d=0x0 a=2 r=0x7f0b0013}
使用android:id/empty代替color/transparent也会给出相同的建议。如何完全隐藏组指示器?
编辑:事实证明,如果将该代码放在drawable资源文件夹中而不是layout中,则该代码确实有效。
mExpandableListView.setGroupIndicator(null)
完成。 - Phil