Search code examples
androidandroid-viewpagerfragmentandroid-tablayout

Using TabLayout and ViewPager in fragment


I'm using Tablayout in fragment, and there is no problem.

enter image description here

but when i click on items and open details fragment (i add the new fragment in back stack) after pop back stack, The Tablayout root fragment just show tabs and viewPager is empty.

enter image description here

How can i solve this problem?


Solution

  • I solved problem. should use getChildFragmentManager() instead getSupportFragmentManager() to assign view pager adapter