Article From:https://segmentfault.com/q/1010000010611561
Question:

Code address: https://github.com/zilongo/Te…

I have a fragmentA, which is the structure of tabLayout+ViewPager+Fragment, and then I need to create a new set of types. The length is almost tabLayout+ViewPager+Fragment structure.I copied a fragmentB from the previous fragmentA and loaded it in the same way. Why is it white?

Code address: https://github.com/zilongo/Te…

Answer 0:

That’s more accurate upstairs. It’s really a problem with getSupportFragmentManager (), but there’s no need to replace SlidingTabLayout.
mMyFragmentPagerAdapter = new MyFragmentPagerAdapter(getChildFragmentManager());
mViewPager.setAdapter(mMyFragmentPagerAdapter);
mTab.setViewPager(mViewPager);
You can.
Do not use mTab.setViewPager (mViewPager, getTitles (), getActivity (), mFragmentLists).

Answer 1:

If you encounter a mistake, look at the error code first, and you usually have a wrong report.

Adapter is empty.

Answer 2:

useFragmentStatePagerAdapterWant a go

Answer 3:

Look at it. It feels like it’s used.SlidingTabLayout The problem is that the internal implementation of this control is used directlygetSupportFragmentManager() No usegetChildFragmentManager()

Why don’t you use TabLayout?

// UPDATE

Should be the problem here, I made a submission after fork: https://github.com/twiceyuan/…

Leave a Reply

Your email address will not be published. Required fields are marked *