android / views-widgets-samples

Multiple samples showing the best practices in views-widgets on Android.
Apache License 2.0
5.03k stars 3.01k forks source link

currentItem of viewPager2 doesn't work properly. #195

Open tjrkdgnl opened 3 years ago

tjrkdgnl commented 3 years ago

hello!! Sir

I have problem for currentItem of ViewPager2. currently, I have connected the viewPager2 and the tabLayout through tablayoutMediator. and I attached OnTabSelectedListener to the tabLayout. also I made a log inside onTabSelected method to check the value of cuurentItem. At this point, if I swipe the viewPager2, the currentItem works fine. But when I touch the tab, currentItem doesn't work properly..

please let me know what's wrong. thank you.

Environment version of android studio is = 3.6.3 release version of viewPager2 is 1.0.0

Connecting viewPager2 and tabLayout image

Attach Listener to tabLayout image