Custom keyboard - Android

假装没事ソ 提交于 2019-12-31 04:12:38

问题


Is there any known combinations of inputTypes on an inputText that would give a Num-pad keyboard with special characters such as $, *, # and &. I am trying to allow the user to input a number and that field could take the mentioned characters as well. I have tried many but none seem to be giving the required output.

Would I have to create my own custom keyboard for this? Since my request is very specific to certain special characters please do not mark this as a duplicate question. Thanks in advance.


回答1:


You can use KeyboardView to for customizing as your need.

KeyboardView customKeyboard = new KeyboardView(context);
customKeyboard.setKeyboard(new Keyboard(this, R.xml.customLayout));

customKeyboard.setOnKeyboardActionListener(new OnKeyboardActionListener() {
    //do your work here
}

Where R.xml.customLayout refers to /res/xml/customLayout.xml. A very good tutorial for customizing a keyboard is..

  • create-your-own-custom-keyboard-for.html

Which will help you much better.



来源:https://stackoverflow.com/questions/14676566/custom-keyboard-android

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