Expandable ListView

后端 未结 3 1661
[愿得一人]
[愿得一人] 2020-12-18 01:30

I am using expandableListView for UI design, so I am wondering for Android expandable listview, is there a way to allow only one list item expanded, i.e. when you click and

3条回答
  •  无人及你
    2020-12-18 02:11

    You could do as kieran suggested, or if you only have one open at a time, you could just keep track of which one you last clicked. You could do this by declaring int lastclicked in the class body then in the listener as Korean suggested, put list.collapseGroup(lastclicked)

    I would give a code example, but I'm on my mobile. Sorry.

    But I just personally prefer the lastclicked method of doing it than using a for loop. It seems more efficient.

提交回复
热议问题