Android EditText、inputType 值 (xml)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2712761/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 07:02:39  来源:igfitidea点击:

EditText, inputType values (xml)

androidlayoutandroid-edittextandroid-inputtype

提问by jgauffin

Where can I find the values that InputTypecan has?

我在哪里可以找到InputType可以拥有的值?

I'm aware of http://developer.android.com/reference/android/text/InputType.html, but how should the values look like in layout xml files?

我知道http://developer.android.com/reference/android/text/InputType.html,但是布局 xml 文件中的值应该如何?

回答by Ravi Vyas

You can use the properties tab in eclipse to set various values.

您可以使用 eclipse 中的属性选项卡来设置各种值。

here are all the possible values

这是所有可能的值

  • none
  • text
  • textCapCharacters
  • textCapWords
  • textCapSentences
  • textAutoCorrect
  • textAutoComplete
  • textMultiLine
  • textImeMultiLine
  • textNoSuggestions
  • textUri
  • textEmailAddress
  • textEmailSubject
  • textShortMessage
  • textLongMessage
  • textPersonName
  • textPostalAddress
  • textPassword
  • textVisiblePassword
  • textWebEditText
  • textFilter
  • textPhonetic
  • textWebEmailAddress
  • textWebPassword
  • number
  • numberSigned
  • numberDecimal
  • numberPassword
  • phone
  • datetime
  • date
  • time
  • 没有任何
  • 文本
  • textCapCharacters
  • 文字大写字
  • textCapSentences
  • 文本自动更正
  • 文本自动完成
  • 文本多行
  • 文本输入多行
  • 文本无建议
  • 文本Uri
  • 文本电子邮件地址
  • 文本电子邮件主题
  • 文本短消息
  • 文本长消息
  • 文字人名
  • 文本邮政地址
  • 文本密码
  • 文本可见密码
  • 文字网页编辑文字
  • 文本过滤器
  • 文字拼音
  • 文本网络电子邮件地址
  • 文本网络密码
  • 数字
  • 数字签名
  • 数字十进制
  • 号码密码
  • 电话
  • 约会时间
  • 日期
  • 时间

Check here for explanations: http://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType

检查这里的解释:http: //developer.android.com/reference/android/widget/TextView.html#attr_android: inputType

回答by Suragch

Supplemental answer

补充答案

Here is how the standard keyboard behaves for each of these input types.

以下是标准键盘对每种输入类型的行为方式。

enter image description here

在此处输入图片说明

See this answerfor more details.

有关更多详细信息,请参阅此答案

回答by Hamed Jaliliani

android:inputMethod

is deprecated, instead use inputType:

已弃用,而是使用inputType

 android:inputType="numberPassword"