直接上代码和图片。
情况一:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<fragment
android:id="@+id/titles"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
class="com.a2bgeek.fragmentdemo.TitlesFragment" />
<FrameLayout
android:id="@+id/details"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="2" >
</FrameLayout>
</LinearLayout>
情况2:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<fragment
android:id="@+id/titles"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
class="com.a2bgeek.fragmentdemo.TitlesFragment" />
<FrameLayout
android:id="@+id/details"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2" >
</FrameLayout>
</LinearLayout>
情况三:
Fragment这个东西在wrap_content的情况下会占据全部,和控件不太一样。
对于一般的控件来讲,可以参考http://blog.csdn.net/jincf2011/article/details/6598256。
分享到:
相关推荐
为什么有时候像android:layout_marginBottom等变量的赋值为负数? 例如如下代码: android:orientation="vertical" android:id="@id/Widget_2X4_frame" android:layout_width="fill_parent" android:...
Android layout_weight使用方法及实例,需要的朋友可以参考一下
点对点 Android_Layout_之_RelativeLayout_代码实现相对布局 使用
layout_gravity 在 线性布局 和 帧布局 中的应用 通过代码 直观的展示 layout_gravity 和 gravity 的区别
Android支持多屏幕机制即用为当前设备屏幕提供一种合适的方式来共同管理并解析应用资源。本文就介绍了4中Android屏幕自适应解决方案。...传统的layout_weight使用方法是将当前控件的layout_width和layout_
-<LinearLayout android:background="@drawable/aaa" android:weightSum="1" android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" xmlns:android=...
用Eclipse加载项目工程 <LinearLayout xmlns:android=... android:layout_weight="0.66" android:background="@drawable/blue_bg" android:orientation="vertical" > android:layout
在继续深入Android开发之旅之前,有必要解决前两篇中没有介绍的遗留问题:View的几种布局显示方法,以后就不会在针对布局方面做过多的介绍。View的布局显示方式有下面几种:线性布局(Linear Layout)、相对布局...
android编程:界面UI元素介绍、Android中应用界面布局以及常用widget组件
-<LinearLayout android:background="@drawable/aaa" android:weightSum="1" android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" xmlns:android=...
android_layout属性大全,包括layou的各种属性的汉语意思.方便查找对应个属性
layout_weight的作用是设置子空间在LinearLayout的重要度(控件的大小比重)。layout_weight的值越低,则控件越重要,下面为大家介绍下具体的使用方法
android:layout_width= match_parent android:layout_height= wrap_content > <Button android:layout_width= match_parent android:layout_height= wrap_content android:singleLine= true />...
NULL 博文链接:https://trylovecatch.iteye.com/blog/1195121
android:layout_weight="1" android:id="@+id/vp" android:layout_width="match_parent" android:layout_height="0dp"></android.support.v4.view.ViewPager> android:paddingTop="10dp" android:background...
Android中gravity与layout_gravity的区别
Android dynamic loading layout
android:layout_weight="1" android:orientation="horizontal"> android:id="@+id/tv_solid_number" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="本次上架...
android:layout_weight="1" android:layout_height="wrap_content" android:text="行1列2" /> <TextView android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content...