您现在的位置是:首页 > 文章详情

浅谈EditText控件的inputType类型

日期:2018-04-08点击:582

      

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"--URI和URL格式  
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"--时间键盘

 

其中大多数是用不到的,这里总结一下常用的几种键盘效果

 

1、numberDecimal(可以带小数点的浮点格式)

      只可以输入0-9数字 和 小数点 ,即只浮点数

  

 

2、number (数字格式 )

     只可以输入0-9数字,与numberDecimal区别是 不能输入小数点 ,点击0-9外的都无效

  

 

3、textPassword (密码格式)

   默认为手机当前设置的输入键盘类型,附带效果,输入的字符会变成星号*   ,一般用于密码框的输入 。

 

 

   

 

原文链接:https://yq.aliyun.com/articles/587584
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章