简单的RelativeLayout布局

简单的RelativeLayout布局

简单的RelativeLayout布局实例

简单的RelativeLayout布局-LMLPHP

 <?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/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="Please input the username and password to log on."
android:textSize="14sp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
/>
<TextView
android:id="@+id/text_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/textView1"
android:layout_alignLeft="@id/textView1"
android:layout_marginRight="20dp"
android:text="User Name:"
android:textSize="20sp"
android:layout_marginBottom="20dp"
/> <EditText
android:id="@+id/edit_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/text_username"
android:layout_toRightOf="@id/text_username"
android:layout_alignRight="@id/textView1"
android:layout_below="@id/textView1"
/> <TextView
android:id="@+id/text_psw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/text_username"
android:layout_alignLeft="@id/text_username"
android:layout_marginRight="20dp"
android:text="Password"
android:textSize="20sp"
/> <EditText
android:id="@+id/edit_psw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/text_psw"
android:layout_alignLeft="@id/edit_username"
android:layout_alignRight="@id/edit_username"
android:layout_below="@id/edit_username"
android:inputType="textPassword" /> <Button
android:id="@+id/btn_logon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@id/edit_psw"
android:text="Log in"
android:textSize="21sp"
android:layout_below="@id/edit_psw"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
/> <Button
android:id="@+id/btn_signin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/btn_logon"
android:layout_toLeftOf="@+id/btn_logon"
android:text="Sign in"
android:textSize="21sp" /> </RelativeLayout>
05-07 00:06