用于设置EditText控件默认输入的内容类型
官方文档内容
android:inputType
The type of data being placed in a text field, used to help an input method decide how to let the user enter text. The constants here correspond to those defined by InputType
. Generally you can select a single value, though some can be combined together as indicated. Setting this attribute to anything besides none also implies that the text is editable.
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
date | 14 | For entering a date. Corresponds to InputType.TYPE_CLASS_DATETIME |
datetime | 4 | For entering a date and time. Corresponds to InputType.TYPE_CLASS_DATETIME |
none | 0 | There is no content type. The text is not editable. |
number | 2 | A numeric only field. Corresponds to InputType.TYPE_CLASS_NUMBER |
numberDecimal | 2002 | Can be combined with number and its other options to allow a decimal (fractional) number. Corresponds to InputType.TYPE_CLASS_NUMBER |
numberPassword | 12 | A numeric password field. Corresponds to InputType.TYPE_CLASS_NUMBER |
numberSigned | 1002 | Can be combined with number and its other options to allow a signed number. Corresponds toInputType.TYPE_CLASS_NUMBER |
phone | 3 | For entering a phone number. Corresponds to InputType.TYPE_CLASS_PHONE . |
text | 1 | Just plain old text. Corresponds to InputType.TYPE_CLASS_TEXT |
textAutoComplete | 10001 | Can be combined with text and its variations to specify that this field will be doing its own auto-completion and talking with the input method appropriately. Corresponds to InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE . |
textAutoCorrect | 8001 | Can be combined with text and its variations to request auto-correction of text being input. Corresponds to InputType.TYPE_TEXT_FLAG_AUTO_CORRECT . |
textCapCharacters | 1001 | Can be combined with text and its variations to request capitalization of all characters. Corresponds to InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS . |
textCapSentences | 4001 | Can be combined with text and its variations to request capitalization of the first character of every sentence. Corresponds to InputType.TYPE_TEXT_FLAG_CAP_SENTENCES . |
textCapWords | 2001 | Can be combined with text and its variations to request capitalization of the first character of every word. Corresponds to InputType.TYPE_TEXT_FLAG_CAP_WORDS . |
textEmailAddress | 21 | Text that will be used as an e-mail address. Corresponds to InputType.TYPE_CLASS_TEXT |
textEmailSubject | 31 | Text that is being supplied as the subject of an e-mail. Corresponds to InputType.TYPE_CLASS_TEXT |
textFilter | b1 | Text that is filtering some other data. Corresponds to InputType.TYPE_CLASS_TEXT |
textImeMultiLine | 40001 | Can be combined with text and its variations to indicate that though the regular text view should not be multiple lines, the IME should provide multiple lines if it can. Corresponds to InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE . |
textLongMessage | 51 | Text that is the content of a long message. Corresponds to InputType.TYPE_CLASS_TEXT |
textMultiLine | 20001 | Can be combined with text and its variations to allow multiple lines of text in the field. If this flag is not set, the text field will be constrained to a single line. Corresponds to InputType.TYPE_TEXT_FLAG_MULTI_LINE . |
textNoSuggestions | 80001 | Can be combined with text and its variations to indicate that the IME should not show any dictionary-based word suggestions. Corresponds to InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS . |
textPassword | 81 | Text that is a password. Corresponds to InputType.TYPE_CLASS_TEXT |
textPersonName | 61 | Text that is the name of a person. Corresponds to InputType.TYPE_CLASS_TEXT |
textPhonetic | c1 | Text that is for phonetic pronunciation, such as a phonetic name field in a contact entry. Corresponds to InputType.TYPE_CLASS_TEXT |
textPostalAddress | 71 | Text that is being supplied as a postal mailing address. Corresponds to InputType.TYPE_CLASS_TEXT |
textShortMessage | 41 | Text that is the content of a short message. Corresponds to InputType.TYPE_CLASS_TEXT |
textUri | 11 | Text that will be used as a URI. Corresponds to InputType.TYPE_CLASS_TEXT |
textVisiblePassword | 91 | Text that is a password that should be visible. Corresponds to InputType.TYPE_CLASS_TEXT |
textWebEditText | a1 | Text that is being supplied as text in a web form. Corresponds to InputType.TYPE_CLASS_TEXT |
textWebEmailAddress | d1 | Text that will be used as an e-mail address on a web form. Corresponds to InputType.TYPE_CLASS_TEXT |
textWebPassword | e1 | Text that will be used as a password on a web form. Corresponds to InputType.TYPE_CLASS_TEXT |
time | 24 | For entering a time. Corresponds to InputType.TYPE_CLASS_DATETIME |