android fragment 标签使用
来源:互联网 发布:淘宝店流量是什么意思 编辑:程序博客网 时间:2024/06/03 13:39
我们在写布局的时候会用到<fragment>标签,但是当使用这个标签时,你知道View的层级关系吗?
activity的layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00ff00" android:orientation="vertical"> <fragment android:id="@+id/play_fragment" android:name="com.sohudm.module.media.fragment.PlayFragment" android:layout_width="match_parent" android:background="#0000ff" android:layout_height="230dp" /></LinearLayout>
fragment的layout
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:background="#ff0000" android:layout_height="400dp"> <FrameLayout android:id="@+id/play_root_layout" android:layout_width="match_parent" android:background="@color/setting_log_unselect" android:layout_height="220dp"> <com.sohudm.module.media.widgets.VideoView android:id="@+id/video_view" android:layout_width="match_parent" android:layout_height="200dp"> </com.sohudm.module.media.widgets.VideoView> <com.sohudm.module.media.widgets.MediaController android:id="@+id/media_controller" android:layout_width="match_parent" android:layout_height="200dp"> </com.sohudm.module.media.widgets.MediaController> </FrameLayout></LinearLayout>
最终的布局是LinearLayout 套LinearLayout 套FrameLayout,需要注意的是,第二个LinearLayout的width和height属性是采用<fragment>标签中设置的属性,其他属性还是采用自身的。
0 0
- android fragment 标签使用
- Android使用Fragment实现标签页
- Android使用ViewPager+Fragment实现标签分页
- Android 使用Fragment,ViewPagerIndicator 仿网易新闻客户端Tab标签
- android sdk自带的fragment标签使用
- Android Fragment应用实战,使用碎片向ActivityGroup说再见(使用Fragment实现底部标签页效果)
- Android Fragment使用
- Android Fragment使用详解
- Android Fragment使用详解
- Android Fragment使用
- android Fragment 使用
- Android Fragment使用详解
- Android Fragment使用
- Android Fragment使用
- Android Fragment使用详解
- Android Fragment的使用
- Android-Fragment的使用
- Android Fragment的使用
- 一次循环删除std::vector元素的方法
- free命令中cached和buffers的区别
- Android RecyclerView添加头部与尾部
- 使用cxf整合spring出现Cannot create URL for this address
- 用 LDA 做主题模型:当 MLlib 邂逅 GraphX
- android fragment 标签使用
- 458. poor pigs
- iframe与主框架跨域访问
- Python——os模块
- 在开发中经常用到的一些sql语句,但相对比较复杂一些的
- 66. Plus One
- 【模拟】洛谷 P1423 小玉在游泳
- Spark性能优化指南——基础篇
- 洛谷p3764签到题3