scrollToItem
Source set: Common
override suspend fun scrollToItem(index: Int)
scrollToItem
Source set: Common
public suspend fun scrollToItem(@AndroidXIntRange(from = 0) index: Int, scrollOffset: Int = 0)
Instantly brings the item at index to the top of the viewport, offset by scrollOffset pixels.
Parameters
| index | the index to which to scroll. Must be non-negative. |
| scrollOffset | the offset that the item should end up after the scroll. Note that positive offset refers to forward scroll, so in a top-to-bottom list, positive offset will scroll the item further upward (taking it partly offscreen). |