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

If I understand the question, you want to scroll to a specific position but that position is the adapter’s position and not the RecyclerView‘s item position.

You can only achieve this through the LayoutManager.

Do something like:

rv.getLayoutManager().scrollToPosition(youPositionInTheAdapter).

Leave a Comment