相对布局(下)

1. RelativeLayout布局的新特性

2. 练习

 

1. RelativeLayout布局的新特性

   

 

2. 练习

    

 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 2     xmlns:tools="http://schemas.android.com/tools"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     android:padding="38dp"    //边间距为了美观
 6     tools:context="first.pack.MainActivity$PlaceholderFragment" >
 7 
 8     <TextView
 9        android:id="@+id/login"
10        android:layout_width="match_parent"
11        android:layout_height="wrap_content"
12        android:gravity="center"    //居中
13        android:text="Landing interface"
14        android:textSize="18sp" 
15        /> 
16        
17     <EditText
18         android:id="@+id/usernameText"
19         android:hint="username"      //提示字, 一旦打字上去就会消失
20         android:layout_width="wrap_content"
21         android:layout_height="wrap_content"
22         android:layout_below="@+id/login"
23         android:layout_alignParentLeft="true"
24         android:layout_alignParentRight="true"
25         />
26    
27     <EditText
28         android:id="@+id/passwordText"
29         android:hint="password"
30         android:inputType="textPassword"  //输入会变成密码星号
31         android:layout_width="wrap_content"
32         android:layout_height="wrap_content"
33         android:layout_below="@+id/usernameText"
34         android:layout_alignLeft="@+id/usernameText"
35         android:layout_alignRight="@+id/usernameText"
36         />
37     
38     <Button
39         android:id="@+id/cancelButton"
40         android:text="Cancel"
41         android:textSize="13sp"
42         android:layout_width="wrap_content"
43         android:layout_height="wrap_content" 
44         android:layout_below="@+id/passwordText"
45         android:layout_alignRight="@+id/passwordText"/>
46     
47     <Button
48         android:id="@+id/okButton"
49         android:text="Login"
50         android:textSize="13sp"
51         android:layout_width="wrap_content"
52         android:layout_height="wrap_content" 
53         android:layout_below="@+id/passwordText"
54         android:layout_toLeftOf="@+id/cancelButton"/>
55 
56 </RelativeLayout>

        

 

转载于:https://www.cnblogs.com/iMirror/p/3810342.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值