0

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

Sam
  • 89
  • 6
  • AFAIK, what you want is not possible. For example, on phone-sized screens in landscape, the default behavior is to hide the activity UI, giving the user a larger keyboard and larger typing area. The original `EditText` is not even visible in this state. – CommonsWare Jul 06 '17 at 15:42
  • Thanks for the response!! Would you check out SwiftKey Keyboard app from Google Play store? It is actually able to undock the keyboard and move around the screen. Do you think it is still possible? – Sam Jul 06 '17 at 18:43

0 Answers0