Android(安卓)ExpandableListView 无child 时 setGroupIndicator 不需要显示的问题

转自:GMAIL 邮件列表


I've been fighting with styling on ExpandableListView as well (an area
that could use some improvement in a future release).

The problem with the current implementation is in the selector element
for the group expander. It can be found in expander_group.xml and
looks like this:

<selector xmlns:android="">
android:drawable="@drawable/expander_ic_maximized" />
android:drawable="@drawable/expander_ic_minimized" />

The problem is that it lacks a state for empty. The code and
attributes support it (state_empty) but it isn't defined in here.
Here are the hypothetical (completely untested) steps you could use to
achieve this:

- Grab the existing expander_group.xml and put it into your drawable
- Modify it to include a section for the empty state with no image.
Something like this:
<item android:state_empty="true" android:drawable="@drawable/
- Modify your ExpandableListView element and set the group indicator
to be your private expander_group.xml

Let us know how it works out. For myself, I need even more control so
I'm about to move to the "roll my own" stage.



<item android:state_empty="true" android:drawable="@drawable/