Reputation: 2486
I have an expandable list that I am creating using a custom adapter class extending BaseExpandableListAdapter
. Is there a way for me to add an empty view child under each of the groups in my expandable list when there are no items in that group?
EDIT:
I tried to use mExpList.setEmptyView(getActivity().findViewById(R.id.empty_child));
but it did not work. R.id.empty_child
is in the same xml right below the expandable list view.
Upvotes: 7
Views: 2302
Reputation: 9117
In the getChildView() method, you can determine if that group has any children. If there aren't any, you can return an Empty View.
At the same time, you will need to adjust the other related methods like, getChildrenCount(), getChild() etc.
Upvotes: 8