How to build custom keyboard that would display right under focused text field in Android Studio?

68 Views Asked by At

can anyone teach me how to configure Android keyboard? I want the keyboard to display right underneath the text field when it is focused. I am assuming I need to undock the keyboardView container first, then display it underneath the text field.

And android:layout_width and android:layout_height never works for me. Can anyone tell me why?

I have been trying to figure out in the past month and still no luck. Any hints?

Here is java code:

    @Override
    public View onCreateInputView() {
    kv = (KeyboardView)getLayoutInflater().inflate(R.layout.keyboard, null);
    keyboard = new Keyboard(this, R.xml.qwerty);
    kv.setKeyboard(keyboard);
    kv.setOnKeyboardActionListener(this);
    return kv;
}

Here is the xml:

<android.inputmethodservice.KeyboardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/keyboard"
    android:layout_width="100dp"
    android:layout_height="50dp"
    android:keyPreviewLayout ="@layout/preview"
    android:keyTextColor = "#8EFFA1"
/>

Thank you

0

There are 0 best solutions below