Child selection in ExpandableListView

后端 未结 2 1180
慢半拍i
慢半拍i 2021-01-14 13:44

In an ExpandableListView is it possible to initially select a child item so that the containing group is expanded and the list is scrolled to this child\'s posi

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-14 14:28

    In an ExpandableListView is it possible to initially select a child item so that the containing group is expanded and the list is scrolled to this child's position:

    //select child and open it's group
    ExpListView.setSelectedChild(groupPos, childPos, true);
    //scroll to selected child
    ExpListView.smoothScrollToPosition(ExpListView.getFlatListPosition(ExpListView.getPackedPositionForChild(groupPos, childPos)));
    

提交回复
热议问题