Edittext android:inputType 输入的限制

39 篇文章 0 订阅

Edittext 输入的限制

限制只输入某些值包括数字、字母等
android:digits=”0123456789abcdefghigklmnopqrstuvwxyz”
上面这行代码可以是你任何的限制,只能输入什么就到里面写就可以了,上面写的是只可以输入数字和字母。
android:inputType=”textPassword”
android:digits=”0123456789abcdefghigklmnopqrstuvwxyz”
这里是只能输入数字和字母并且是密码格式,这两个设置并没有冲突,
android:inputType=”textPassword” 这里是文本,是可以输入中文的,但是要是你加了
android:digits=”0123456789abcdefghigklmnopqrstuvwxyz” ,inputType 这里的中文就会失效了,但是 password 不会失效,这里只是打个比方,大家都懂的。

inputType的属性值

android:inputType=”none”
android:inputType=”text”
android:inputType=”textCapCharacters” 字母大写
android:inputType=”textCapWords” 首字母大写
android:inputType=”textCapSentences” 仅第一个字母大写
android:inputType=”textAutoCorrect” 自动完成
android:inputType=”textAutoComplete” 自动完成
android:inputType=”textMultiLine” 多行输入
android:inputType=”textImeMultiLine” 输入法多行(如果支持)
android:inputType=”textNoSuggestions” 不提示
android:inputType=”textUri” 网址
android:inputType=”textEmailAddress” 电子邮件地址
android:inputType=”textEmailSubject” 邮件主题
android:inputType=”textShortMessage” 短讯
android:inputType=”textLongMessage” 长信息
android:inputType=”textPersonName” 人名
android:inputType=”textPostalAddress” 地址
android:inputType=”textPassword” 密码
android:inputType=”textVisiblePassword” 可见密码
android:inputType=”textWebEditText” 作为网页表单的文本
android:inputType=”textFilter” 文本筛选过滤
android:inputType=”textPhonetic” 拼音输入 //数值类型
android:inputType=”number” 数字
android:inputType=”numberSigned” 带符号数字格式
android:inputType=”numberDecimal” 带小数点的浮点格式
android:inputType=”phone” 拨号键盘
android:inputType=”datetime” 时间日期
android:inputType=”date” 日期键盘
android:inputType=”time” 时间键盘

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值