Kevin Gilbert
Kevin Gilbert

Reputation: 723

RecyclerView: Go to a position not scroll to

Is there a way with the RecyclerView to go directly to a nominated position rather than scroll to it. (If the distance to the target is large and the item layout complex, scrolling can take an acceptable amount of time.)

Upvotes: 7

Views: 6975

Answers (2)

Abd Qadr
Abd Qadr

Reputation: 63

You can use recyclerView.scrollToPosition(position) instead of smoothScrollToPosition(position).

Upvotes: 1

Libin
Libin

Reputation: 17085

Use ScrollToPosition to go directly to a position on RecyclerView

recyclerView.scrollToPosition(your_position)

http://developer.android.com/reference/android/support/v7/widget/RecyclerView.html#scrollToPosition(int)

Upvotes: 14

Related Questions