Center a ListView on its current selection

前端 未结 3 1703
故里飘歌
故里飘歌 2021-02-08 10:16

Does anyone know of a way to center a ListView based on its current selection or selection set with setSelection?

I did see this other StackOverflow question without any

3条回答
  •  醉梦人生
    2021-02-08 10:33

    I haven't tried any of this but based on the current selection could you use public void smoothScrollByOffset (int offset) to get the view to scroll to where you want so that your selection is in the middle of the view?

提交回复
热议问题