Android - How to disable certain keys in virtual keyboard

流过昼夜 提交于 2019-12-29 09:15:09

问题


How to disable certain keys (say number/symbol keys) in Android virtual keyboard?

Specifically I want user can't input a double quote ( " ) character when virtual keyboard is showed up when user focus on a standard android EditText widget.


回答1:


How to disable certain keys (say number/symbol keys) in Android virtual keyboard?

You can't, sorry. After all, the input method editor may not have "keys" in the first place.

Specifically I want user can't input a double quote ( " ) character when virtual keyboard is showed up when user focus on a standard android EditText widget.

Then you will have to block the input at the EditText, by means of an InputFilter, as is described here: How do I use InputFilter to limit characters in an EditText in Android?




回答2:


why don't you use android:inputType="..." for your EditText

http://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType



来源:https://stackoverflow.com/questions/11411608/android-how-to-disable-certain-keys-in-virtual-keyboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!