CarouselState

Class

Android
@ExperimentalTvMaterial3Api
class CarouselState(initialActiveItemIndex: Int = 0)

State of the Carousel which allows the user to specify the first item that is shown when the Carousel is instantiated in the constructor.

It also provides the user with support to pause and resume the auto-scroll behaviour of the Carousel.

Parameters

initialActiveItemIndexthe index of the first active item

Properties

Android
var activeItemIndex

The index of the item that is currently displayed by the carousel

Functions

fun pauseAutoScroll(itemIndex: Int): ScrollPauseHandle

Pauses the auto-scrolling behaviour of Carousel. The pause request is ignored if itemIndex is not the current item that is visible. Returns a ScrollPauseHandle that can be used to resume

Companion Object

Properties

Android
val Saver: Saver<CarouselState, *>

The default Saver implementation for CarouselState.