android / views-widgets-samples

Multiple samples showing the best practices in views-widgets on Android.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

currentItem of viewPager2 doesn't work properly.

tjrkdgnl opened this issue · comments

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