手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >Android layout_weight使用方法及实例
Android layout_weight使用方法及实例
摘要:直接上代码和图片。情况一:[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>

Android layout_weight使用方法及实例1

情况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>

Android layout_weight使用方法及实例2

情况三:

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

【Android layout_weight使用方法及实例】相关文章:

Android Thread 介绍与实例

Android控件系列之Shape使用方法

Android控件系列之EditText使用方法

Android在JNI中使用ByteBuffer的方法

Android RelativeLayout相对布局属性简析

Android控件系列之TextView使用介绍

Android 文件操作方法

Android 编程下字库的使用及注意事项

Android GridView的使用

Android定制RadioButton样式三种实现方法

精品推荐
分类导航