开发者

How to change the keyboard input type on Android

开发者 https://www.devze.com 2023-02-21 07:40 出处:网络
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 usi

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:

  1. You can try to use an invisible EditText and try if this gets the InputType
  2. You could replace your TextView by an EditText, and then overwrite the style of this EditText with a custom one.
0

精彩评论

暂无评论...
验证码 换一张
取 消