romandanylyk / PageIndicatorView

An page indicator for Android ViewPager
4.62k stars 550 forks source link

Support for ViewPager2 #139

Open soroushLotfi opened 3 years ago

soroushLotfi commented 3 years ago

Please add support for ViewPager2. It doesn't work when I pass the id of a ViewPager2 to piv_viewPager.

segunfrancis commented 3 years ago

I'm facing the same issue. I initially set the view pager inside XML but it was not working. I then tried to set it programmatically and got a compile error

Quelake commented 3 years ago

Same here, want to incorporate ViewPager2 but it breaks the functionality. Please review the PR that is open that will enable the support for viewpager2 please! Thanks

victorManuelOllervidez commented 3 years ago

In case of someone needs use this library with ViewPager2 add this lines:

pageIndicatorView.count = pageAdapter.itemCount (inside your Fragment/Activity)

and inside of ViewPager2.OnPageChangeCallback.onPageSelected set:

pageIndicatorView.selection = position