我希望我ExpandableListView在用户展开组时自动滚动,以便展开的组标题位于屏幕顶部.我试过了smoothScrollToPosition,但这只是确保扩展组在屏幕上的某个位置可见.我想明确滚动它,以便扩展组位于顶部,如下例所示:
Before expanding Group 3: After expanding Group 3:
+=================+ +=================+
| Group 1 | | Group 3 |
+-----------------+ +-----------------+
| Group 2 | | Grp 3 Child 1 |
+-----------------+ +-----------------+
| Group 3 | | Grp 3 Child 2 |
+-----------------+ +-----------------+
| Group 4 | | Group 4 |
+=================+ +=================+
Run Code Online (Sandbox Code Playgroud)