ANDROID_MARS学习笔记_S01_009Relative_LAYOUT例子

1.

 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     android:paddingLeft="16dp"
 6     android:paddingRight="16dp" >
 7     <EditText
 8         android:id="@+id/name"
 9         android:layout_width="match_parent"
10         android:layout_height="wrap_content"
11         android:hint="@string/reminder" />
12     <Spinner
13         android:id="@+id/dates"
14         android:layout_width="0dp"
15         android:layout_height="wrap_content"
16         android:layout_below="@id/name"
17         android:layout_alignParentLeft="true"
18         android:layout_toLeftOf="@+id/times" />
19     <Spinner
20         android:id="@id/times"
21         android:layout_width="96dp"
22         android:layout_height="wrap_content"
23         android:layout_below="@id/name"
24         android:layout_alignParentRight="true" />
25     <Button
26         android:layout_width="96dp"
27         android:layout_height="wrap_content"
28         android:layout_below="@id/times"
29         android:layout_alignParentRight="true"
30         android:text="@string/done" />
31 </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:paddingBottom="@dimen/activity_vertical_margin"
 6     android:paddingLeft="@dimen/activity_horizontal_margin"
 7     android:paddingRight="@dimen/activity_horizontal_margin"
 8     android:paddingTop="@dimen/activity_vertical_margin"
 9     tools:context="com.example.s01_e15_realtivelayout01.MainActivity" >
10 
11     <TextView
12         android:id="@+id/first"
13         android:layout_width="wrap_content"
14         android:layout_height="wrap_content"
15         android:background="#ff0000"
16         android:text="用户登录" 
17         android:layout_centerHorizontal="true"/>
18     
19     <EditText 
20         android:id="@+id/username"
21         android:layout_width="wrap_content"
22         android:layout_height="wrap_content"
23         android:layout_alignParentLeft="true"
24         android:layout_alignParentRight="true"
25         android:hint="username"
26         android:layout_below="@id/first"/>
27     <EditText 
28         android:id="@+id/password"
29         android:layout_width="match_parent"
30         android:layout_height="wrap_content"
31         android:hint="password"
32         android:inputType="textPassword"
33         android:layout_below="@id/username"/>
34      <Button 
35         android:layout_width="wrap_content"
36         android:layout_height="wrap_content"
37         android:text="登录"
38         android:layout_below="@id/password"
39         android:layout_toLeftOf="@+id/cancel"/>
40     <Button
41         android:id="@id/cancel"
42         android:layout_width="wrap_content"
43         android:layout_height="wrap_content"
44         android:text="取消"
45         android:layout_below="@id/password"
46         android:layout_alignParentRight="true"/>
47  
48 
49 
50 </RelativeLayout>

 

转载于:https://www.cnblogs.com/shamgod/p/5186534.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值