ogaclejapan / SmartTabLayout

A custom ViewPager title strip which gives continuous feedback to the user when scrolling
Apache License 2.0
7.09k stars 1.34k forks source link

Bug When I pop backstack #104

Closed kazixma closed 8 years ago

kazixma commented 8 years ago

When I pop backstack of fragments and smarttablayout in this fragment then I try to open this fragment again smart tab layout is not reset to first and not clear cache . I want to clear cache of smart tab layout, How I do ?

Thank you so much and sorry for bad english.

ghost commented 8 years ago

Me too. I build a navigation drawer with 4 items for example but when I returned to first item smart tab layout didn't reset. Why?

ogaclejapan commented 8 years ago

Hi, @kazixma @Phoenix000

Do you use the Fragment#getChildFragmentManager ? This problem will occur if you are using the Fragment#getFragmentManager.

If using fragment inside a ViewPager, Must be use getChildFragmentManager.

// BAD
FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
  getFragmentManager(), FragmentPagerItems.with(getContext())
  .add(...)
  .create());

// GOOD
FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
  getChildFragmentManager(), FragmentPagerItems.with(getContext())
  .add(...)
  .create());

It is not a bug in the SmartTabLayout : (

ghost commented 8 years ago

Thank you very much

ghost commented 8 years ago

For design can you add ripple drawable for lower api in tabs when this are pressed?

ogaclejapan commented 8 years ago

Hi, @Phoenix000

It is possible if customize the tab. https://github.com/ogaclejapan/SmartTabLayout#how-to-customize-the-tab

joaoarmando commented 7 years ago

thanks for this solution!

JulyanMayer commented 2 years ago

Hi, @kazixma @Phoenix000

Do you use the Fragment#getChildFragmentManager ? This problem will occur if you are using the Fragment#getFragmentManager.

If using fragment inside a ViewPager, Must be use getChildFragmentManager.

// BAD
FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
  getFragmentManager(), FragmentPagerItems.with(getContext())
  .add(...)
  .create());

// GOOD
FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
  getChildFragmentManager(), FragmentPagerItems.with(getContext())
  .add(...)
  .create());

It is not a bug in the SmartTabLayout : (

Thx <3