Android五大布局之RelativeLayout 示例代码

来源:互联网 发布:淘宝卖家三钻 编辑:程序博客网 时间:2024/05/22 04:35
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <TextView
        android:id="@+id/numberTV"
        android:layout_width="80dp"
        android:layout_height="wrap_content"
        android:text="@string/number" />
    <EditText
        android:id="@+id/numberET"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/numberTV"
        android:inputType="phone" />
    <TextView
        android:id="@+id/contentTV"
        android:layout_width="80dp"
        android:layout_height="wrap_content"
        android:layout_below="@id/numberET"
        android:text="@string/content" />
    <EditText
        android:id="@+id/contentET"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/numberET"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@+id/contentTV"
        android:ems="10"
        android:inputType="textMultiLine"
        android:lines="3" /> 
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/contentET"
        android:onClick="onClick"
        android:text="@string/send" />

</RelativeLayout>


效果图: