Edittext inputtype is used to set your input type for edittext.
Ex:- You can set your edittext inputtype as ‘Phone’. So that user can able to type only numbers. If it is ‘Time’ it will allow only time related characters to be entered.
Edittext Inputtypes are:-
- text
- textCapCharacters
- textCapWords
- textCapSentences
- textAutoCorrect
- textAutoComplete
- textMultiLine
- textImeMultiLine
- textNoSuggestions
- textUri
- textEmailAddress
- textEmailSubject
- textShortMessage
- textLongMessage
- textPersonName
- textPostalAddress
- textPassword
- textVisiblePassword
- textWebEditText
- textFilter
- textPhonetic
- number
- numberSigned
- numberDecimal
- phone
- datetime
- date
- time
1 | <EditText android:id="@+id/EditText01" |
2 | android:layout_height="wrap_content" |
3 | android:layout_width="wrap_content" |
4 | android:inputType="number" |
5 | android:text="9944456789"/> |
Here the inputType is ‘Number’. You can set one or more inputType to a edittext at a time.
The Output will look like

本文详细介绍了Android中EditText组件的各种输入类型设置方法,如文本、电话号码、日期等,并通过实例展示了如何将输入类型设为数字。
1768

被折叠的 条评论
为什么被折叠?



