消失SmartTabLayout pageViewer内容 [英] Disappear SmartTabLayout pageViewer content
问题描述
我试图用SmartTabLayout从这里 https://github.com/ogaclejapan/SmartTabLayout 和我有一个抽屉里。当我点击在抽屉上的项目,我代替我的片段,与smarttablayout到片段。对于第一次没关系,smarttablayout有内容的标签,但是当我在抽屉里点击同一项目,标签的内容只是消失,并且向他们展示回来我必须滚动到年底,并滚动回来,向他们展示。我不知道为什么。
注:如果使用ViewPager里面的片段,必须用片段#getChildFragmentManager()
块引用>的https://github.com/ogaclejapan/SmartTabLayout#pageradapter-for-fragment-based-page
FragmentPagerItemAdapter适配器=新FragmentPagerItemAdapter(
getChildFragmentManager(),FragmentPagerItems.with(this.getA())
。新增(R.string.item_pager_title_products,ProductListFragment.class)
。新增(R.string.item_pager_title_shops,ShopListFragment.class)
。创建());FYI:得到同样的问题,因为我没有阅读手册...原来的答复在这里找到<一href=\"http://stackoverflow.com/a/25525714/1257369\">http://stackoverflow.com/a/25525714/1257369
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.
解决方案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 http://stackoverflow.com/a/25525714/1257369
这篇关于消失SmartTabLayout pageViewer内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!