HorizontalPagerIndicator

fun HorizontalPagerIndicator(pagerState: PagerState, pageCount: Int, modifier: Modifier = Modifier, pageIndexMapping: (Int) -> Int = { it }, activeColor: Color = LocalContentColor.current.copy(alpha = LocalContentAlpha.current), inactiveColor: Color = activeColor.copy(ContentAlpha.disabled), indicatorWidth: Dp = 8.dp, indicatorHeight: Dp = indicatorWidth, spacing: Dp = indicatorWidth, indicatorShape: Shape = CircleShape)(source)

A horizontally laid out indicator for a androidx.compose.foundation.pager.HorizontalPager or androidx.compose.foundation.pager.VerticalPager, representing the currently active page and total pages drawn using a Shape.

This element allows the setting of the indicatorShape, which defines how the indicator is visually represented.

Parameters

modifier

the modifier to apply to this layout.

pageCount

the size of indicators should be displayed. If you are implementing a looping pager with a much larger pageCount than indicators should displayed, e.g. Int.MAX_VALUE, specify you real size in this param.

pageIndexMapping

describe how to get the position of active indicator by the giving page from androidx.compose.foundation.pager.PagerState.currentPage.

activeColor

the color of the active Page indicator

inactiveColor

the color of page indicators that are inactive. This defaults to activeColor with the alpha component set to the ContentAlpha.disabled.

indicatorWidth

the width of each indicator in Dp.

indicatorHeight

the height of each indicator in Dp. Defaults to indicatorWidth.

spacing

the spacing between each indicator in Dp.

indicatorShape

the shape representing each indicator. This defaults to CircleShape.

Samples

com.google.accompanist.sample.pager.HorizontalPagerIndicatorSample