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.

我正在寻找一种从 RecyclerView 调用“jumpTo(targetPosition)”的方法。目前我正在使用“LinearLayoutManager.scrollToPositionWithOffset(位置,偏移)”,但当位置在屏幕上不可见时并不总是执行。

例如。- listSize = 100 - 当前在屏幕上/可见 19,20,21,22,23 - scrollToPositionWithOffset(30,0) //FAIL - scrollToPositionWithOffset(22,0) //SUCCESS

4

1 回答 1

0

RecyclerView.scrollToPosition(int position)的调用方法

mRecyclerView.scrollToPosition(position) // whatever your index is.
于 2017-07-19T04:31:45.750 回答