可能重复:
ExpandableListView - hide indicator for groups with no children
隐藏没有孩子的群组的指标
main.xml中
<ExpandableListView
android:id="@+id/elv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:groupIndicator="@drawable/selector">
</ExpandableListView>
selector.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_empty="true" android:drawable="@android:color/transparent"/>
<item android:state_expanded="true" android:drawable="@drawable/expanded" />
<item android:drawable="@drawable/collapse" />
</selector>
它对我的ICS不起作用,似乎所有已折叠组的状态都为空
答案 0 :(得分:12)
试试这个:
getExpandableListView().setGroupIndicator(null);
否则,
if ( getChildrenCount( groupPosition ) == 0 ) {
indicator.setVisibility( View.INVISIBLE );
}
else {
indicator.setVisibility( View.VISIBLE );
indicator.setImageResource( isExpanded ? R.drawable.group_expanded : R.drawable.group_closed );
}