简单的RelativeLayout布局

简单的RelativeLayout布局实例

 

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5      >
 6 
 7     <TextView
 8         android:id="@+id/textView1"
 9         android:layout_width="wrap_content"
10         android:layout_height="wrap_content"
11         android:layout_alignParentTop="true"
12         android:layout_centerHorizontal="true"
13         android:layout_marginTop="20dp"
14         android:text="Please input the username and password to log on."
15         android:textSize="14sp"
16         android:textAppearance="?android:attr/textAppearanceMedium"
17         android:layout_marginLeft="20dp"
18         android:layout_marginRight="20dp"
19         android:layout_marginBottom="20dp"
20          />
21     <TextView 
22         android:id="@+id/text_username"
23         android:layout_width="wrap_content"
24         android:layout_height="wrap_content"
25         android:layout_below="@id/textView1"
26         android:layout_alignLeft="@id/textView1"
27         android:layout_marginRight="20dp"
28         android:text="User Name:"
29         android:textSize="20sp"
30         android:layout_marginBottom="20dp"
31         />
32     
33     <EditText 
34         android:id="@+id/edit_username"
35         android:layout_width="match_parent"
36         android:layout_height="wrap_content"
37         android:layout_alignBaseline="@id/text_username"
38         android:layout_toRightOf="@id/text_username"
39         android:layout_alignRight="@id/textView1"     
40         android:layout_below="@id/textView1"
41         />
42           
43     
44     <TextView 
45         android:id="@+id/text_psw"
46         android:layout_width="wrap_content"
47         android:layout_height="wrap_content"
48         android:layout_below="@id/text_username"
49         android:layout_alignLeft="@id/text_username"
50         android:layout_marginRight="20dp"
51         android:text="Password"
52         android:textSize="20sp"
53         />
54 
55     <EditText
56         android:id="@+id/edit_psw"
57         android:layout_width="wrap_content"
58         android:layout_height="wrap_content"
59         android:layout_alignBaseline="@id/text_psw"
60         android:layout_alignLeft="@id/edit_username"
61         android:layout_alignRight="@id/edit_username"
62         android:layout_below="@id/edit_username"
63         android:inputType="textPassword" />
64 
65     <Button
66         android:id="@+id/btn_logon"
67         android:layout_width="wrap_content"
68         android:layout_height="wrap_content"
69         android:layout_alignRight="@id/edit_psw"
70         android:text="Log in"
71         android:textSize="21sp"
72         android:layout_below="@id/edit_psw"
73         android:layout_marginTop="20dp"
74         android:layout_marginLeft="20dp"
75         />
76 
77     <Button
78         android:id="@+id/btn_signin"
79         android:layout_width="wrap_content"
80         android:layout_height="wrap_content"
81         android:layout_alignBaseline="@+id/btn_logon"
82         android:layout_toLeftOf="@+id/btn_logon"
83         android:text="Sign in"
84         android:textSize="21sp" />
85 
86 </RelativeLayout>

 

posted @ 2015-01-06 02:18  iRac  阅读(537)  评论(0编辑  收藏  举报