Is Nested Fragment Possible?(嵌套片段可能吗?)
问题描述
我有一个 ViewPager 包含三个片段,我想将 3 个新片段放入第三个片段中.可以吗?
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?
推荐答案
是的,可以嵌套片段.
在处理嵌套片段时,您必须使用 getChildFragmentManager() 而不是 getFragmentManager().有关详细信息,请查看 此链接.
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....:)
这篇关于嵌套片段可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:嵌套片段可能吗?
基础教程推荐
- SwiftUI-ScrollViewReader的ScrollTo不滚动 2022-01-01
- iOS - UINavigationController 添加多个正确的项目? 2022-01-01
- 为什么姜饼模拟器方向卡在应用程序中? 2022-01-01
- Android Volley - 如何动画图像加载? 2022-01-01
- 如何比较两个 NSDate:哪个是最近的? 2022-01-01
- navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 2022-01-01
- Xcode UIView.init(frame:) 只能在主线程中使用 2022-01-01
- Play 商店的设备兼容性问题 2022-01-01
- 如何将图像从一项活动发送到另一项活动? 2022-01-01
- UIImage 在开始时不适合 UIScrollView 2022-01-01
