Pergunta

I want to hide the group indicator based on the groupPosition in ExpandableListView.

I am not using any custom groupindicator under ExpandableListView like below.

<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/my_icon_max" />
<item android:drawable="@drawable/my_icon_min" />
</selector>

I cannot use currentOffersListView.setGroupIndicator(null); becuase this applies to all the items.

So is there any way to hide the default group indicator.

Thanks

Foi útil?

Solução

I suggest setting the groupIndicator value to null and instead use a drawable right for your list. In the getGroupView method of your adapter, set the drawable for the view of your list row.

getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)

with this, you can now say to your adapter that

if(groupPosition == x)
    drawableRight = null;

//set compoundDrawable for whatever view you are using.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top