我希望我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 |
+=================+ +=================+