Empty view in extensible list adapter

I have an extensible list that I create using an adaptive adapter class that extends BaseExpandableListAdapter . Is there a way to add an empty view child under each of the groups in the expandable list if there are no items in this group?

EDIT: I tried to use mExpList.setEmptyView(getActivity().findViewById(R.id.empty_child)); but that didn't work. R.id.empty_child is in the same xml right below the dropdown.

+6
source share
1 answer

In the getChildView () method, you can determine if this group has any children. If not, you can return an empty view.

At the same time, you will need to configure other related methods, for example, getChildrenCount () , getChild () , etc.

+8
source

Source: https://habr.com/ru/post/947082/


All Articles