tommybuonomo / dotsindicator

Three material Dots Indicators for view pagers in Android !

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid indicator position using ViewPager2

Magno-Ramos opened this issue · comments

I'm using ViewPager2.

When I setCurrentItem to ViewPager2 with smoothScroll=false, the indicator remains at the start position and not at the correct ViewPager2 position

Have the same problem :/
with smoothScroll=true it is working

You need add delay before set current page. My decision
Handler(Looper.getMainLooper()).postDelayed({ binding.dotsIndicator.refreshDots() }, 50)

It's becase dots have not received coordinates yet and pos = 0,0 for any page. We need to wait, while they are drawn on the canvas

Fixed in 4.3

Hello, thanks for your contribution !
This issue is now fixed in the new version 4.3
Thanks 🔥