🌈 Create new beautiful Compose Gradients with our new wesite ->
Function

scrollToItem

Instantly brings the item at index to the center of the viewport and positions it based on the Configuration.anchorType and applies the scrollOffset pixels.

scrollToItem

Source set: Android
public suspend fun scrollToItem(
        /*@IntRange(from = 0)*/
        index: Int,
        /*@IntRange(from = 0)*/
        scrollOffset: Int = 0,
    )

Instantly brings the item at index to the center of the viewport and positions it based on the Configuration.anchorType and applies the 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).

Content updated: