Search code examples
javaandroidkeyboardandroid-custom-viewandroid-keypad

Custom keyboard - Android


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.


Solution

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