android经验

2.EditText基础

2017-04-05  本文已影响34人  积木Blocks

目录

  1. 简介
  2. 常用属性
  3. 常见功能需求实现
  4. 常见问题
  5. 小技巧

1.简介


2.常用属性

NO 属性 作用
1 android:hint 提示文字内容
2 android:textColorHint 修改hint文字的颜色
3 android:textCursorDrawable 修改光标的图片
4 android:inputType 输入类型
5 android:digits 输入限制
6 android:cursorVisible 是否显示光标
7 android:editable 是否可以编辑
8 android:password 密码键盘
9 android:phoneNumber 拨号键盘
10 android:numeric 数字键盘
11 android:capitalize 英文键盘
12 android:imeOptions 设置右下角IME动作
13 android:imeActionId 设置IME动作ID
14 android:imeActionLabel 设置IME动作标签
15 android:focusableInTouchMode 是否开启触控焦点
16 android:focusable 获取焦点

2.1 android:hint
<EditText ...android:hint="请输入您的账号" />

2.2 android:textColorHint
<EditText ...android:textColorHint="@color/colorPrimary" />

2.4 android:inputType
NO 属性 含义
1 date 日期键盘
2 datetime 日期时间键盘
3 none 普通输入(默认)
4 number 数字键盘
5 numberDecimal 可带小数点的数字键盘
6 numberSigned 有符号(正负号)数字键盘
7 numberPassword 数字密码键盘
8 phone 拨号键盘
9 text 普通输入
10 textAutoComplete 自动补全
11 textAutoCorrect 自动纠错
12 textCapCharacters 大写键盘
13 textCapSentences 仅第一个字母大写
14 textCapWords 单词首字母大写
15 textEmailAddress 电子邮件地址格式
16 textEmailSubject 邮件主题格式
17 textFilter 文本筛选格式
18 textImeMultiLine 输入法多行(不一定支持)
19 textLongMessage 长消息格式
20 textMultiLine 多行输入
21 textNosuggestions 无内容提示
22 textPassword 文字密码键盘
23 textPersonName 人名格式
24 textPhonetic 拼音输入格式
25 textPostalAddress 邮政格式
26 textShortMessage 短消息格式
27 textUri URI格式
28 textVisiblePassword 文字密码可见
29 textWebEditText 作为网页表单的文本格式
30 textWebEmailAddress 作为网页表单的电子邮件地址格式
31 textWebPassword 作为网页表单的密码格式
32 time 时间键盘

2.5 android:digits
 android:digits="0123456789"
 android:digits="qwertyuiopasdfghjklzxcvbnm0123456789"

上一篇 下一篇

猜你喜欢

热点阅读