https://kotlinlang.org logo
Title
y

Yingding Wang

02/23/2023, 7:22 PM
What is the new
HorizontalPagerIndicator
for
androidx.compose.foundation.pager.PagerState
? I switched from Accompanist to Compose Foundation 1.4.0-beta02, but can’t find PagerIndicator.
b

Ben Trengrove [G]

02/23/2023, 9:21 PM
You can still use the accompanist one. There isn't one in androidX
y

Yingding Wang

02/24/2023, 10:41 AM
I can not mix the PagerState, the Accompanist HorizontalPagerIndicator doesn’t take the
androidx.compose.foundation.pager.PagerState
, can i just cast it to the Accompanist PagerState? Otherwise I have to copy over the PagerState and make duplicates.
b

Ben Trengrove [G]

02/24/2023, 9:19 PM
You shouldn't have to, we added support for androidX pager here. https://github.com/google/accompanist/pull/1485
y

Yingding Wang

02/25/2023, 9:23 AM
I see, thanks so much. It works now. It turns out for the
accompanist-pager-indicators 0.29.1-alpha
, I need to explicitly pass a
pageCount
in the composable
HorizontalPagerIndicator
. Otherwise the wrong composable is picked.