首页 > 移动平台 > 详细

Android布局解析(未完,持续更新)

时间:2015-07-07 02:01:21      阅读:231      评论:0      收藏:0      [点我收藏+]

LinearLayout:相当于Java GUI中的FlowLayout(流式布局),就是说啊一个组件后边跟一个,挨着靠,一个组件把一行占满了,就靠到下一行。

LinearLayout.xml

<LinearLayout
    android:id="@+id/L1"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/tv"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="3"
        android:background="#ffff2821"
        />

    <LinearLayout
        android:id="@+id/L21"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/tv2"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:background="#ff3fb200"/>

        <TextView
            android:id="@+id/tv3"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="2"
            android:background="#ff3436b2"/>

        <TextView
            android:id="@+id/tv5"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:background="#ff7a75b2"/>

        <LinearLayout
            android:id="@+id/L27"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="6"
            android:orientation="vertical">

            <LinearLayout
                android:id="@+id/L37"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="2"
                android:background="#ff44ff16"
                android:orientation="horizontal">

            </LinearLayout>

            <LinearLayout
                android:id="@+id/L32"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:background="#ff382aff"
                android:orientation="horizontal">

            </LinearLayout>
        </LinearLayout>
    </LinearLayout>


</LinearLayout>

效果:

技术分享

 

Android布局解析(未完,持续更新)

原文:http://www.cnblogs.com/somewhater/p/4625815.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!