0

I'm trying to use SmartTabLayout from here https://github.com/ogaclejapan/SmartTabLayout, and i have a drawer. When i'm clicking at item on drawer, i replace my fragment, to fragment with smarttablayout. For first time it's ok, smarttablayout have tabs with content, but when i click in drawer on the same item, content of tabs just disappear, and to show them back i have to scroll to the end, and scroll back, to show them. I don't have idea why.

Przemek
  • 111
  • 6

1 Answers1

1

Notes: If using fragment inside a ViewPager, Must be use Fragment#getChildFragmentManager().

https://github.com/ogaclejapan/SmartTabLayout#pageradapter-for-fragment-based-page

FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
            getChildFragmentManager(), FragmentPagerItems.with(this.getA())
            .add(R.string.item_pager_title_products, ProductListFragment.class)
            .add(R.string.item_pager_title_shops, ShopListFragment.class)
            .create());

FYI: Had same problem because I didn't read the manual... Original answer found here https://stackoverflow.com/a/25525714/1257369

Community
  • 1
  • 1
everyman
  • 3,377
  • 1
  • 34
  • 33