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

animateScrollToItem

Animate (smooth scroll) the given item at index to the center of the viewport and position it based on the Configuration.anchorType and applies the scrollOffset pixels.

animateScrollToItem

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

Animate (smooth scroll) the given item at index to the center of the viewport and position 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 (same as scrollToItem) - 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: