How to change the keyboard input type on Android
I know that when using a EditText we can change t开发者_如何学运维he input type using the setInputType(InputType.TYPE_CLASS_TEXT);
method. But, I'm not using a EditText, I'm showing the keyboard using the imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY)
, getting the input values on the onKey event and showing them in a TextView for specific reasons. :)
There's some way to change the input type through the InputMethodManager?
Thanks in advance.
That's quite weird, I can only think two workarounds:
- You can try to use an invisible EditText and try if this gets the InputType
- You could replace your TextView by an EditText, and then overwrite the style of this EditText with a custom one.
精彩评论