Android: ViewPager gets stuck in between views

后端 未结 8 1460
天命终不由人
天命终不由人 2021-02-02 11:30

I have a ViewPager which swipes between Fragments. I\'m using a FragmentStatePagerAdapter to feed the Fragments to the ViewPager. If the user swipes left at a normal pace, and t

8条回答
  •  忘掉有多难
    2021-02-02 12:14

    In my case, the problem was an empty Fragment. After create a fragment with a layout, it's starts working as expected.

    Basically, I used a empty fragment for test the view:

    fragment = new Fragment(); //Strange behavior in ViewPager
    

    When I used the final fragment which has a layout, the behavior was the correct:

    fragment = MyFragment.newInstance(); //Correct behavior
    

    I know that this response doesn't answer the current question, but some people with similar problems arrive here. So, I hope it's helpful.

提交回复
热议问题