首页 > 技术文章 > 用户友好的输入界面

LY1124 2015-07-24 09:04 原文

 

Demo2\youhao\src\main\res\layout\activity_main.xml

 1 <TableLayout 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:stretchColumns="1"
 6     tools:context=".MainActivity">
 7 
 8     <TableRow>
 9 
10         <TextView
11             android:layout_width="match_parent"
12             android:layout_height="wrap_content"
13             android:text="用户名"
14             android:textSize="16dp" />
15 
16         <EditText
17             android:layout_width="match_parent"
18             android:layout_height="wrap_content"
19             android:hint="请填写登录账号"
20             android:selectAllOnFocus="true" />
21     </TableRow>
22 
23     <TableRow>
24 
25         <TextView
26             android:layout_width="match_parent"
27             android:layout_height="wrap_content"
28             android:text="密码"
29             android:textSize="16dp" />
30 
31         <EditText
32             android:layout_width="match_parent"
33             android:layout_height="wrap_content"
34             android:hint="请填写登录密码"
35             android:inputType="numberPassword" />
36     </TableRow>
37 
38     <TableRow>
39 
40         <TextView
41             android:layout_width="match_parent"
42             android:layout_height="wrap_content"
43             android:text="年龄"
44             android:textSize="16dp" />
45 
46         <EditText
47             android:layout_width="match_parent"
48             android:layout_height="wrap_content"
49             android:hint="请填写年龄"
50             android:inputType="number" />
51     </TableRow>
52 
53     <TableRow>
54 
55         <TextView
56             android:layout_width="match_parent"
57             android:layout_height="wrap_content"
58             android:text="生日"
59             android:textSize="16dp" />
60 
61         <EditText
62             android:layout_width="match_parent"
63             android:layout_height="wrap_content"
64             android:hint="请填写生日"
65             android:inputType="date" />
66     </TableRow>
67 
68     <TableRow>
69 
70         <TextView
71             android:layout_width="match_parent"
72             android:layout_height="wrap_content"
73             android:text="电话号码"
74             android:textSize="16dp" />
75 
76         <EditText
77             android:layout_width="match_parent"
78             android:layout_height="wrap_content"
79             android:hint="请填写电话号码"
80             android:inputType="phone"
81             android:selectAllOnFocus="true" />
82     </TableRow>
83 
84     <Button
85         android:layout_width="wrap_content"
86         android:layout_height="wrap_content"
87         android:text="注册
88         " />
89 </TableLayout>

 

推荐阅读