how to use a ViewPager in a fragment

前端 未结 4 1640
甜味超标
甜味超标 2021-01-14 15:29

I download a project about ViewPager and CirclePageIndicator. It works well on my tablet and its code is :

Test1Activity.java:

TestFragmentAdapter mA         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-14 16:08

    Android does not support fragments inside of fragments. Either switch your ViewPager to use a PagerAdapter that does not use fragments, or do not put the ViewPager in a fragment.

    EDIT:

    Now, Android supports fragments inside fragments by using Fragment.getChildFragmentManager() . Have a look at this answer.

提交回复
热议问题