scrollToPositionWithOffset

open fun scrollToPositionWithOffset(position: Int, offset: Int)(source)

Scroll to the specified adapter position with the given offset from resolved layout start. Resolved layout start depends on getReverseLayout, getLayoutDirection and getStackFromEnd.

For example, if layout is VERTICAL and getStackFromEnd is true, calling scrollToPositionWithOffset(10, 20) will layout such that item[10]'s bottom is 20 pixels above the RecyclerView's bottom.

Note that scroll position change will not be reflected until the next layout call.

If you are just trying to make a position visible, use scrollToPosition.

Parameters

position

Index (starting at 0) of the reference item.

offset

The distance (in pixels) between the start edge of the item view and start edge of the RecyclerView.

See also