注册界面设计及实现之(一)注册界面的开发实现

开发步骤: 

  • 在布局文件中设置视图组件 
  • 创建视图优化xml文件并绑定组件 
  • 添加按钮单击事件并实现验证机制

布局组件结构的设计分析:

 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" android:paddingLeft="16dp"
 5     android:paddingRight="16dp"
 6     android:paddingTop="16dp"
 7     android:paddingBottom="16dp" tools:context=".Register_Activity"
 8     android:background="@drawable/bg">
 9     <LinearLayout
10         android:orientation="vertical"
11         android:layout_width="fill_parent"
12         android:layout_height="wrap_content"
13         android:background="@drawable/login_border_bg"
14         android:padding="10dp">
15         <TableLayout
16             android:layout_width="fill_parent"
17             android:layout_height="wrap_content"
18             android:collapseColumns="2"
19             android:stretchColumns="1">
20             <TableRow
21                 android:layout_width="fill_parent"
22                 android:layout_height="wrap_content">
23                 <TextView
24                     android:layout_width="wrap_content"
25                     android:layout_height="wrap_content"
26                     android:text="注册帐号:"
27                     android:textSize="15sp"
28                     android:textColor="#000000"/>
29                 <EditText
30                     android:id="@+id/txtRegAccount"
31                     android:layout_width="fill_parent"
32                     android:layout_height="35dp"
33                     android:hint="请输入注册帐号:"
34                     android:textSize="12sp"
35                     android:textColor="#000000"
36                     android:background="@drawable/txt_bg"
37                     android:paddingLeft="10dp"/>
38             </TableRow>
39             <TableRow
40                 android:layout_width="fill_parent"
41                 android:layout_height="wrap_content">
42                 <TextView
43                     android:layout_width="wrap_content"
44                     android:layout_height="wrap_content"
45                     android:text="登录密码:"
46                     android:textSize="15sp"
47                     android:textColor="#000000"/>
48                 <EditText
49                     android:id="@+id/txtRegPassword"
50                     android:layout_width="fill_parent"
51                     android:layout_height="35dp"
52                     android:hint="请输入登录密码:"
53                     android:textSize="12sp"
54                     android:textColor="#000000"
55                     android:inputType="textPassword"
56                     android:background="@drawable/txt_bg"
57                     android:paddingLeft="10dp"
58                     android:layout_marginTop="10dp"/>
59             </TableRow>
60             <TableRow
61                 android:layout_width="fill_parent"
62                 android:layout_height="wrap_content">
63                 <TextView
64                     android:layout_width="wrap_content"
65                     android:layout_height="wrap_content"
66                     android:text="确认密码:"
67                     android:textSize="15sp"
68                     android:textColor="#000000"/>
69                 <EditText
70                     android:id="@+id/txtReRegPassword"
71                     android:layout_width="fill_parent"
72                     android:layout_height="35dp"
73                     android:hint="请输入确认登录密码:"
74                     android:textSize="12sp"
75                     android:textColor="#000000"
76                     android:inputType="textPassword"
77                     android:background="@drawable/txt_bg"
78                     android:paddingLeft="10dp"
79                     android:layout_marginTop="10dp"/>
80             </TableRow>
81         </TableLayout>
82         <LinearLayout
83             android:layout_width="fill_parent"
84             android:layout_height="wrap_content"
85             android:orientation="horizontal"
86             android:layout_marginTop="10dp">
87             <Button
88                 android:id="@+id/btnAdd"
89                 android:layout_width="0dp"
90                 android:layout_height="35dp"
91                 android:text="立即注册"
92                 android:textSize="15sp"
93                 android:textColor="#646464"
94                 android:layout_weight="1"
95                 android:background="@drawable/btn_reg_bg"
96                 android:layout_marginRight="5dp"/>
97         </LinearLayout>
98     </LinearLayout>
99 </RelativeLayout>
activity_register.xml

运行:

花朵开放的时候花蕾消逝,人们会说花蕾是花朵否定了的;同样地,当结果的时刻花朵又被解释为植物的一种虚假的存在形式,而果实是作为植物的真实形式而取代花朵的。这些形式不但彼此不同,而且互相排斥,互不相容。但是,他们的流动性却使他们成为有机统一体的环节,他们在有机统一体中不但互相抵触,而且彼此都同样是必要的;而正是这种同样的必要性才构成整体的生命。
原文地址:https://www.cnblogs.com/zulo/p/5081456.html