Android: FragmentPagerAdapter: getItem method called twice on First time

前端 未结 5 1468
一整个雨季
一整个雨季 2020-12-15 04:44

In My application, I have used the ViewPager. Like,

(say main.xml)



        
5条回答
  •  抹茶落季
    2020-12-15 05:10

    My Problem is getItem() method is called twice on First time

    This is not the problem, this is default feature of FragmentPagerAdapter. Its good for you to swipe from this page to the next one and previous one.

    the view displayed in the emulator is 0th index, but got 1st Index value in the FragmentActivity

    I got the same issue, and I know why. This because you used same Fragment in View Pager.

    How to fix this is separate Fragments by using different Fragment.

提交回复
热议问题