InputType of EditText in Android

2020-04-10 03:58发布

问题:

I would like to have following: - number keyboard should be displayed first - but it should be possible to change to text keyboard and to type some letters.

I've asked almost the same question and accepted an answer. InputType of EditText in Android

But now I found some strange behaviour, setting InputType to Number: it is possible to change keyboard to text type, but it's impossible to type some text.

Any Ideas, why does it happen_

Does anybody know how to use TYPE_MASK_CLASS as input type?

Thank you

回答1:

You are right and I didn't find any answer to that except if you wrote your own keyboard.
TYPE_MASK_CLASS is for masking class of EditorInfo in keyboard development.



回答2:

android:inputType="textPersonName|number|numberSigned|numberDecimal"

Paste it for Numerical Input type

android:inputType="text|textCapCharacters|textCapWords|textCapSentences|textAutoCorrect|textAutoComplete|textMultiLine|textImeMultiLine|textPersonName" Paste it for Alphabetical Input type