How can I completely hide the groupIndicator of an ExpandableListView?

Patrick Dattilio picture Patrick Dattilio · May 2, 2011 · Viewed 35.2k times · Source

I want to completely hide the groupIndicator in a custom ExpandableListView.

The example provided here did not seem to work.

It suggests making a selector and using expList.setGroupIndicator(selector), which I replicated:

<?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>

This gives the following error
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}

The same is given by the similar suggestion of using android:id/empty in place of color/transparent.

How can I completely hide the group indicator?

Edit: As it turns out, that code DOES work... if you put it in the drawable resource folder instead of layout.

Answer

Michael picture Michael · May 2, 2011

Have you tried changing ExpandableListView's attribute android:groupIndicator="@null"?