2

I want to scroll the RecyclerView to a position, and I use LinearLayoutManager.scrollToPositionWithOffset() to scroll, but it does not work. Could any one help me?

My code:

init the RecyclerView:

mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); 

and in the Button onClick, I do this to scroll the View:

((LinearLayoutManager)mRecyclerView.getLayoutManager()).scrollToPositionWithOffset(position, offset); 

1 Answer 1

2

I think you should use mRecyclerView.smoothScrollToPosition(position) where position is your current position + offset.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.