0

谁能教我如何配置Android键盘?我希望键盘在聚焦时显示在文本字段的正下方。我假设我需要先取消停靠 keyboardView 容器,然后将其显示在文本字段下方。

并且 android:layout_width 和 android:layout_height 对我来说从来没有用过。谁能告诉我为什么?

在过去的一个月里,我一直试图弄清楚,但仍然没有运气。有什么提示吗?

这是java代码:

    @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;
}

这是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"
/>

谢谢

4

0 回答 0