Xml文件  |  138行  |  5.23 KB

<?xml version="1.0" encoding="utf-8"?>
<!--
 * Copyright (C) 2008 The Android Open Source Project.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

    <LinearLayout android:id="@+id/horizontal"
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="100dip"
        android:background="#FF909090">

        <TextView android:id="@+id/gravity_top"
            android:background="#FF00FF00"
            android:layout_width="wrap_content"
            android:layout_height="50dip"
            android:layout_gravity="top"
            android:text="@string/horizontal_text_1"/>

        <TextView android:id="@+id/gravity_center_vertical"
            android:background="#FF00FF00"
            android:layout_width="wrap_content"
            android:layout_height="50dip"
            android:layout_gravity="center_vertical"
            android:text="@string/horizontal_text_2"/>

        <TextView android:id="@+id/gravity_bottom"
            android:background="#FF00FF00"
            android:layout_width="wrap_content"
            android:layout_height="50dip"
            android:layout_gravity="bottom"
            android:text="@string/horizontal_text_3"/>
    </LinearLayout>

    <LinearLayout android:id="@+id/vertical"
        android:orientation="vertical"
        android:layout_width="100dip"
        android:layout_height="wrap_content"
        android:background="#FFFF0909">

        <TextView android:id="@+id/gravity_left"
            android:background="#FF00FF00"
            android:layout_width="wrap_content"
            android:layout_height="20dip"
            android:layout_gravity="left"
            android:text="@string/vertical_text_1"/>

        <TextView android:id="@+id/gravity_center_horizontal"
            android:background="#FF0000FF"
            android:layout_width="wrap_content"
            android:layout_height="20dip"
            android:layout_gravity="center_horizontal"
            android:text="@string/vertical_text_2"/>

        <TextView android:id="@+id/gravity_right"
            android:background="#FF00FF00"
            android:layout_width="wrap_content"
            android:layout_height="20dip"
            android:layout_gravity="right"
            android:text="@string/vertical_text_3"/>
    </LinearLayout>

    <LinearLayout android:id="@+id/weightsum"
        android:orientation="horizontal"
        android:weightSum="1.0"
        android:baselineAligned="false"
        android:layout_width="100dip"
        android:layout_height="100dip"
        android:background="#FF909090">

        <TextView android:id="@+id/weight_0_2"
            android:background="#FF0000FF"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="0.2"
            android:text="@string/horizontal_text_1"/>

        <TextView android:id="@+id/weight_0_5"
            android:background="#FFF00F0F"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="0.5"
            android:text="@string/horizontal_text_2"/>

        <TextView android:id="@+id/weight_0_3"
            android:background="#FF0000FF"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="0.3"
            android:text="@string/horizontal_text_3"/>
    </LinearLayout>

    <LinearLayout android:id="@+id/baseline_aligned_child_index"
        android:orientation="vertical"
        android:baselineAlignedChildIndex="1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#FFFF0909">

        <TextView android:id="@+id/textview1"
            android:background="#FF00FF00"
            android:layout_width="wrap_content"
            android:layout_height="20dip"
            android:layout_gravity="left"
            android:text="@string/vertical_text_1"/>

        <TextView android:id="@+id/textview2"
            android:background="#FF0000FF"
            android:layout_width="wrap_content"
            android:layout_height="20dip"
            android:layout_gravity="center_horizontal"
            android:text="@string/vertical_text_2"/>

        <TextView android:id="@+id/textview3"
            android:background="#FF00FF00"
            android:layout_width="wrap_content"
            android:layout_height="20dip"
            android:layout_gravity="right"
            android:text="@string/vertical_text_3"/>
    </LinearLayout>

</LinearLayout>