嵌套碎片可能吗? [英] Is Nested Fragment Possible?
问题描述
我有一个ViewPager包含三个片段,我想提出3个新的碎片进入第三fragment.Is这可能吗?
I have a ViewPager contains three fragment, and I want to put 3 new fragments into the third fragment.Is that possible?
[ViewPager]
[Fragment 1]
[Fragment 2]
[Fragment 3]
[Fragment 3-1]
[Fragment 3-2]
[Fragment 3-3]
[ViewPager]
编辑:我不能getChildFragmentManager(),但只有getFragmentManager(),我使用android.support.v4.app:
I can't getChildFragmentManager() but only getFragmentManager(), I'm using android.support.v4.app:
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.add(R.layout.tools_frame5, new Plugins());
ft.commit();
编辑:怎么样把第三片段3活动,这是可能的。
what about Putting 3 Activities in the third Fragment, Is that possible?
推荐答案
是的,嵌套的片段是可能的。
Yes, Nested fragment is possible.
您必须使用 getChildFragmentManager()而不是 getFragmentManager(),而你正在使用嵌套的片段工作。有关详细信息看看<一个href=\"http://developer.android.com/reference/android/app/Fragment.html#getChildFragmentManager%28%29\">this链接。
You have to use getChildFragmentManager() instead of getFragmentManager() while you are working with nested fragments. For more details look into this link.
希望这将帮助你....:)
Hope this will help you....:)
这篇关于嵌套碎片可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!