Android layout_weight使用方法及实例_安卓软件开发教程-查字典教程网
Android layout_weight使用方法及实例
Android layout_weight使用方法及实例
发布时间:2016-12-28 来源:查字典编辑
摘要:直接上代码和图片。情况一:[html]复制代码代码如下:情况2:[html]复制代码代码如下:情况三:Fragment这个东西在wrap_c...

直接上代码和图片。

情况一:

[html]

复制代码 代码如下:

<?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"

/>

<FrameLayout

android:id="@+id/details"

android:layout_width="0dip"

android:layout_height="match_parent"

android:layout_weight="2" >

</FrameLayout>

</LinearLayout>

<?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"

/>

<FrameLayout

android:id="@+id/details"

android:layout_width="0dip"

android:layout_height="match_parent"

android:layout_weight="2" >

</FrameLayout>

</LinearLayout>

<?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"

/>

<FrameLayout

android:id="@+id/details"

android:layout_width="0dip"

android:layout_height="match_parent"

android:layout_weight="2" >

</FrameLayout>

</LinearLayout>

情况2:

[html]

复制代码 代码如下:

<?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"

/>

<FrameLayout

android:id="@+id/details"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="2" >

</FrameLayout>

</LinearLayout>

<?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"

/>

<FrameLayout

android:id="@+id/details"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="2" >

</FrameLayout>

</LinearLayout>

情况三:

Fragment这个东西在wrap_content的情况下会占据全部,和控件不太一样。

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新安卓软件开发学习
    热门安卓软件开发学习
    编程开发子分类