0

is there possibility to make list with only one expandable item ? I found many samples and tutorials how to make expandable list with all items expandable.

Tymcio
  • 13
  • 4

1 Answers1

0

Yes, you can use the ExpandableListView and the ExpandableListAdapter, and then implement the getChildrenCount method on ExpandableListAdapter this way:

@Override
public int getChildrenCount(int groupPosition) {
    if(groupPosition == <THE EXPANDABLE POSITION>) {
         return <number of items>
    } else {
         return 0;
    }
}

Doing this, only the group in will be expandable.

Felipe Silveira
  • 513
  • 4
  • 8