[英]How to open Android keyboard show only custom digits in Android
I want to show digits "0123456789/" on keyboard
if open on click of SearchView
but I don't know how it can be done. 如果要在单击
SearchView
时打开,我想在keyboard
上显示数字“ 0123456789 /”,但我不知道该怎么做。 I am able to set InputType
to a searchview like this 我可以将
InputType
设置为这样的searchview
searchView.setInputType(InputType.TYPE_CLASS_NUMBER);
but not able to set custom digit to show on a keyboard
. 但无法设置自定义数字以显示在
keyboard
。
from input type InputType.TYPE_CLASS_NUMBER
numeric keyboard is opening but i also want to show "/" also with numeric digits 0123456789. I searched a lot on SO but didn't find any solution for this. 从输入类型
InputType.TYPE_CLASS_NUMBER
数字键盘打开,但是我也想显示数字0123456789的“ /”。我在SO上进行了大量搜索,但没有找到任何解决方案。
There is no easy solution for this. 对此没有简单的解决方案。 You have two options depending on what you can work with and what exactly you want.
您可以根据自己的工作方式和实际需要选择两个选项。
Custom SoftKeyboard
. Custom SoftKeyboard
。 This will allow you to take only the desired inputs and will show only those characters that you have specified. [onQueryTextChanged]
1 where you manipulate to resend only the values that you can take in as input. [onQueryTextChanged]
1来禁用其他字符输入(不可用),在该[onQueryTextChanged]
1上操作以仅重新发送可以输入的值。 Here the default softKeyboard is used, but the input taken in by the SearchView are as per specification. Note : my knowledge is mainly based on working with EditText
rather than SearchView
, so not able to provide exact codes for the above 注意:我的知识主要是基于使用
EditText
而不是SearchView
,因此无法为上述代码提供确切的代码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.