Nested Fragments
来源:互联网 发布:淘宝售后维修申请 编辑:程序博客网 时间:2024/06/04 22:37
http://developer.android.com/about/versions/android-4.2.html#NestedFragments
You can now embed fragments inside fragments. This is useful for a variety of situations in which you want to place dynamic and re-usable UI components into a UI component that is itself dynamic and re-usable. For example, if you useViewPager
to create fragments that swipe left and right and consume a majority of the screen space, you can now insert fragments into each fragment page.
To nest a fragment, simply call getChildFragmentManager()
on the Fragment
in which you want to add a fragment. This returns a FragmentManager
that you can use like you normally do from the top-level activity to create fragment transactions. For example, here’s some code that adds a fragment from within an existing Fragment
class:
Fragment videoFragment = new VideoPlayerFragment();FragmentTransaction transaction = getChildFragmentManager().beginTransaction();transaction.add(R.id.video_fragment, videoFragment).commit();
From within a nested fragment, you can get a reference to the parent fragment by calling getParentFragment()
.
The Android Support Library also now supports nested fragments, so you can implement nested fragment designs on Android 1.6 and higher.
Note: You cannot inflate a layout into a fragment when that layout includes a <fragment>
. Nested fragments are only supported when added to a fragment dynamically.
- Nested Fragments
- Android Fragment 嵌套使用(Nested Fragments)
- Android Fragment使用 嵌套Fragments (Nested Fragments) 的使用及常见错误
- Android Fragment使用(二) 嵌套Fragments (Nested Fragments) 的使用及常见错误
- Android Fragment使用(二) 嵌套Fragments (Nested Fragments) 的使用及常见错误
- Android Fragment使用(二) 嵌套Fragments (Nested Fragments) 的使用及常见错误
- Fragments
- Fragments
- fragments
- Fragments
- Fragments
- Fragments
- Fragments
- Fragments
- fragments
- Fragments
- Fragments
- Fragments
- UIWebView加载本地pdf、doc等文件
- 暴雪公司有个经典的字符串的hash公式
- FLEX/验证
- matlab自带滤波器函数小结(图像处理)
- ios 中生成随机数
- Nested Fragments
- ios UITapGestureRecognizer 单指单击、单指多击、多指单击、多指多击事件操作
- 各类函数总结
- XP远程桌面连接2008提示:远程计算机需要网络级别身份验证,而您的计算机不支持该验证
- Android 动态布局 动态生成 销毁控件 改变控件的位置等
- 禁止固定IP访问Linux系统
- _USRDLL _AFXDLL _WINDLL 三种dll编译宏的具体含义
- ios 横向滑动选择器 年份+月份
- phpExcel常用方法