How to use RecyclerView.scrollToPosition() to move the position to the top of current view?

前端 未结 5 709
长情又很酷
长情又很酷 2020-12-01 03:03

The RecyclerView.scrollToPosition() is extremely strange. for example, supposed a RecyclerView named \"rv\".

  1. if now i

5条回答
  •  -上瘾入骨i
    2020-12-01 03:13

    try recycler_view.smoothScrollBy(0, 100); here 0 represents x-coordinate and 100 represents y-coordinate I used this in vertical recyclerView where I wanted to scroll to next position in the vertical list and for coming to the previous position I simply replaced 100 with -100

提交回复
热议问题