Android线性布局LinearLayout-实例

2020-05-19  本文已影响0人  a1a4b0d9e20c

1、实现效果

图一:


1589856433(1).png

图二:


1589856451(1).png

2、xml代码

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context="com.example.lizelu.userinterfacedemo.Main2Activity">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <!--垂直线性布局方式-->
        <LinearLayout
            android:layout_width="60pt"
            android:layout_height="match_parent"
            android:background="#ff0000"
            android:orientation="vertical">
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
          
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="50pt"
                android:background="#0000ff"
                android:orientation="horizontal">
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#00ff00"
                android:orientation="horizontal">
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>
</RelativeLayout>
上一篇 下一篇

猜你喜欢

热点阅读