安卓学习笔记:2:用EditView创建一个简单的注册页面
2014-10-30 20:29
721 查看
代码如下:
其中selectAllOnFocus="true" 的作用是获取焦点而不是将光标移动为文本的开始位置或者末尾位置,但是有这个和没这个都调试了几次,没有感觉到明显变化。
inputType这个里面有很多设置输入数据的类型,当调用inputType="numberPassword"的时候,弹出输入法默认的就是数字键,而不是字母表。
运行效果如下:
<?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:stretchColumns="1" > <TableRow> <TextView android:id="@+id/t1" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="用户名:" android:textSize="16sp" /> <!-- selectAllOnFocus="true" 获取焦点而不是将光标移动为文本的开始位置或者末尾位置 --> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="请填写登陆账号" android:selectAllOnFocus="true" /> </TableRow> <TableRow> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="密码:" android:textSize="16sp" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="numberPassword" /> </TableRow> <TableRow> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="年龄:" android:textSize="16sp" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="number" android:maxLength="2" /> </TableRow> <TableRow> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="出生日期:" android:textSize="16sp" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="date" /> </TableRow> <TableRow> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="电话:" android:textSize="16sp" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="phone" android:selectAllOnFocus="true" /> </TableRow> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="注册:" /> </TableLayout>
其中selectAllOnFocus="true" 的作用是获取焦点而不是将光标移动为文本的开始位置或者末尾位置,但是有这个和没这个都调试了几次,没有感觉到明显变化。
inputType这个里面有很多设置输入数据的类型,当调用inputType="numberPassword"的时候,弹出输入法默认的就是数字键,而不是字母表。
运行效果如下:
相关文章推荐
- HTML&CSS基础学习笔记1.22-一个简单的注册页面
- Django学习笔记(二)创建一个简单页面
- 安卓学习笔记:使用PopupWindow创建简单菜单
- 学习笔记:创建一个简单字符设备驱动的过程
- 安卓智慧上海学习笔记系列——禁用ViewPager页面切换效果及不自动加载下一页数据
- 安卓学习日记之使用按钮与Toast创建一个简单的表白app
- Node.js 学习笔记--- (2)创建一个简单的博客工程
- OpenCascade学习笔记-创建一个简单的OpenCascade单文档
- 学习笔记_Java_day14—编码实战___一个注册页面的完整流程
- Python web入门:Django学习与实践二(简单页面实现和创建一个模板)
- C语言学习笔记(二)—— 创建一个简单的C语言程序并详细解析
- maven 学习笔记(二)创建一个简单的 eclipse+android+maven 工程
- 创建一个简单注册页面步骤
- Unity3D Mesh学习笔记1-创建一个最简单的四边形
- xamarin学习笔记A05(安卓RecycleView简单显示)
- twisted 学习笔记二:创建一个简单TCP客户端
- 安卓自学笔记:5:用ImageView创建一个图片浏览器
- 安卓自学笔记:12:用SearchView创建一个搜索框
- 吕鑫MFC就业培训宝典学习笔记—创建一个简单的win32应用程序(2-1)
- 安卓学习笔记---android RecyclerView一个通用的BaseAdapter