Custom keyboard - Android

2019-03-03 01:41发布

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条回答
2楼-- · 2019-03-03 02:19

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..

Which will help you much better.

查看更多
登录 后发表回答