(Smooth)ScrollToPosition doesn't work properly with RecyclerView

后端 未结 16 1379
既然无缘
既然无缘 2020-12-03 04:29

I\'m using basic RecyclerView with GridLayoutManager. I observed that nor smoothScrollToPosition nor scrollToPosition works properly.

a) when using smoothScrol

16条回答
  •  长情又很酷
    2020-12-03 05:01

    Calling the recyclerView smoothScroll isn't effective, as the recyclerView itself doesn't handle its layout.

    What you should do is calling the layout manager scroll method instead.

    This should look something like this

    mRecyclerView.getLayoutManager().scrollToPosition(desiredPosition);
    

提交回复
热议问题