关于xml布局中Fragment与 FrameLayout的理解
发布时间:2020-12-16 09:26:46 所属栏目:百科 来源:网络整理
导读:?xml version="1.0" encoding="utf-8"?LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main" android:layout_width="match_parent" android:layout_height="ma
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" tools:context=".ActionTab_Activity" > <!-- 一定要tool:comtext --> <!--如果是fragment,一定要设置某fragment名字 如 android:name="com.cohere.fc.FragmentProcess" 表示启动时先加载某fragment --> <Fragment android:id="@+id/main_titles" android:name="com.cohere.fc.FragmentProcess" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" /> <pre name="code" class="html"> <!-- FrameLayout是一个放置Fragment的容器 , 不需要指定某个Fragment的名字, 可以通过FragmentManager动态添加删除想放入其中的Fragment--><FrameLayout android:id="@+id/main_details" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="4" /></LinearLayout>
FrameLayout与Fragment标签都是用来放Fragment的,区别是,Fragment标签只能设置固定的Fragment,而FrameLayout中可以通过FragmentManager更换Fragment (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Swift游乐场和模拟器错误(ipc / mig)服务器死机,无法启动iO
- react native之手机定位--Geolocation
- c – 使用std :: optional是否像使用int一样有效?
- c# – 用于实时环境中的通信的WCF或套接字?
- FineReport连接Oracle数据库的问题汇总
- 在Flex中,使用字典作为数据提供者的最佳方法是什么?
- 深度学习论文理解3:Flexible, high performance convoluti
- flex与java--Blazeds学习(配置)
- c – 如何使用KCachegrind和Callgrind仅测量部分代码?
- c# – 这个代码的LINQ方法