添加片段插入片段? [英] Add Fragment into fragment?
问题描述
我创造,我添加使用片段的活性容器:
I create an activity container where I added an fragment using :
FragmentTransaction英尺= getFragmentManager()的BeginTransaction();
ft.replace(R.id.simple_fragment,myFragment); ft.commit();
FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.simple_fragment, myFragment); ft.commit();
其中simple_fragment是容器布局(线性/帧),现在我想从myFragment本身myFragment再添片段。
where simple_fragment is container layout (Linear/Frame), now I want to add another fragment in myFragment from myFragment itself.
更新:
普莱斯是指附加的图像,在这种情况下,我有三个顶部的按钮活动布局,在每一个按钮的点击我与其他片段布局取代缺点布局说片段1/2或3 ....现在从片段1我想调用其他片段1A和从1A到1B。在这里我要维护堆栈,以及用于内部片段视图。
Pleas refer attached image, in this case I have activity layout with three top button, in click of every button i replace downside layout with other fragment layout say Fragment 1/2 or 3 ....now from fragment 1 i want to call other fragment 1A and from 1A to 1B. Here I want to maintain stack as well for inner fragment view.
我怎么能做到这一点,任何一个有关于它的想法/建议?
How can I do this, any one have idea/suggestion about it?
推荐答案
访问承载片段的活动,并要求它来取代你的片段。
Access the Activity that is hosting the Fragment and ask it to replace your Fragment.
像
((MyActivity) getActivity()).goToOtherFragment();
这篇关于添加片段插入片段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!