Programmatically collapse a group in ExpandableListView

后端 未结 5 610
無奈伤痛
無奈伤痛 2020-11-28 21:55

When I expand a new group, can I collapse the last one expanded?

5条回答
  •  一个人的身影
    2020-11-28 22:19

    Do this to expand the clicked group and collapse all others

    public void onGroupExpand(int groupPosition)
    {
        for (int i = 0; i < len; i++)
        {
            if (i != groupPosition)
            {
                expandableListDetailsLevel.collapseGroup(i);
            }
        }
    }
    

    It's working for me.

提交回复
热议问题