I\'m creating an ExpandableListView
with data from a database. For that, I\'m using a CursorTreeAdapter
and I populate it with a Cursor
In your xml add the folowing to ExpandableListView:
android:groupIndicator="@android:color/transparent"
Than each Group Item View in your Adapter needs its internal indicator. You can for example add a ImageView on the right side in your .xml.
Then in the Adapter you do the following:
@Override
protected void bindGroupView(View view, Context paramContext, Cursor cursor, boolean paramBoolean)
...
if (getChildrenCount(groupPosition) > 0) {
viewHolder.indicator.setVisibility(View.VISIBLE);
viewHolder.indicator.setImageResource(
isExpanded ? R.drawable.indicator_expanded : R.drawable.indicator);
} else {
viewHolder.indicator.setVisibility(View.GONE);
}
}