码迷,mamicode.com
首页 > 移动开发 > 详细

ANDROID_MARS学习笔记_S01_009Relative_LAYOUT例子

时间:2016-02-11 18:00:57      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:

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>

 

ANDROID_MARS学习笔记_S01_009Relative_LAYOUT例子

标签:

原文地址:http://www.cnblogs.com/shamgod/p/5186534.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!