1
void jumpTo (int targetPosition)
Instead of specifying pixels to scroll, use the target position to jump using scrollToPosition(int).

You may prefer using this method if scroll target is really far away and you prefer to jump to a location and smooth scroll afterwards.

Note that calling this method takes priority over other update methods such as update(int, int, int, Interpolator), setX(float), setY(float) and #setInterpolator(Interpolator). If you call jumpTo(int), the other changes will not be considered for this animation frame.

I'm looking for a way to call "jumpTo(targetPosition)" from RecyclerView. Currently I'm using "LinearLayoutManager.scrollToPositionWithOffset(position,offset)" but it's not always executed when the position is not visible on screen.

eg. - listSize = 100 - currently on screen/visible 19,20,21,22,23 - scrollToPositionWithOffset(30,0) //FAIL - scrollToPositionWithOffset(22,0) //SUCCESS

Seghers
  • 121
  • 6

1 Answers1

0

Call method of RecyclerView.scrollToPosition(int position)

mRecyclerView.scrollToPosition(position) // whatever your index is.