Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HorizontalPager Parameter "count" not found

I got an error that the parameter could not be found while using the Horizontal Pager.

enter image description here

enter image description here

My Compose Version is

"1.2.0-alpha03"

Kotlin Version is

"1.6.0"

This is the canonical code that puts the size of pages in the count in the parameter.

I don't know why. Please help me.

like image 392
유현명 Avatar asked Jun 16 '26 18:06

유현명


1 Answers

You should know that accompanist is now deprecated and no longer supported and instead you should use androidx.compose.foundation which uses pageCount instead of count. Read this Migration guidance to understand more. Here is a quick fix

       val pagerState = rememberPagerState(pageCount = { 3 })
    HorizontalPager(state = pagerState, verticalAlignment = Alignment.Top) {

    }
like image 200
Peter Gichia Avatar answered Jun 22 '26 08:06

Peter Gichia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!