手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >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 WakeLock使用方法代码实例

Android Thread 介绍与实例

Android GridView的使用

用Android MenuInflater创建菜单项的方法步骤

Android开发笔记 Handler使用总结

Android检测Cursor泄漏的原理以及使用方法

Android界面刷新的方法分享

android 使用虚拟机安装apk(图文教程)

Android实现Service重启的方法

Android 文件操作方法

精品推荐
分类导航