手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >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 MenuInflater创建菜单项的方法步骤

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

android ListView内数据的动态添加与删除实例代码

Android控件系列之Shape使用方法

Android变形(Transform)之Camera使用介绍

Android控件系列之TextView使用介绍

Android RelativeLayout相对布局属性简析

android ListView自动滚动方法

android ListView的右边滚动滑块启用方法 分享

Android界面刷新的方法分享

精品推荐
分类导航