Start native apps faster with the Composables CLI ->
Function

animateScrollToItem

Animate (smooth scroll) to the given item.

animateScrollToItem

Source set: Common
public suspend fun animateScrollToItem(
        @AndroidXIntRange(from = 0) index: Int,
        scrollOffset: Int = 0,
    )

Animate (smooth scroll) to the given item.

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).