Skip to content

position not retained when coming back from another fragment #68

@palicka

Description

@palicka

Hi, I use navigation graph in my app and when I leave fragment which contains viewpager and come back (click on "skip" button in attached gif), viewpager's position is retained, but dots indicator is reset. I know that view is recreated when leaving and coming back, but I noticed ViewPager2.OnPageChangeCallback's onPageSelected is called with last position, but dots indicator somehow doesn't react. But when I scroll , indicator jumps to correct position. Please have a look at attached video. Thanks
ezgif-1-d6bbe5d48bf5

this is how it's initialised in onActivityCreated() method:

        val pagerAdapter = MyViewPagerAdapter(activity!!)
        viewPager.adapter = pagerAdapter
        pagerIndicator.setViewPager2(viewPager)

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions