I made a custom soft keyboard.
XML file:
<?xml version="1.0" encoding="UTF-8"?>
<android.inputmethodservice.KeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/keyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#1B0A33"
android:keyBackground="@drawable/pexeso_keyboard_key"
/>
Java源代码文件:
public class PexesoKeyboard extends InputMethodService implements
KeyboardView.OnKeyboardActionListener {
private KeyboardView kv;
private Keyboard keyboard;
private boolean caps = false;
@Override
public View onCreateInputView() {
kv = (KeyboardView)getLayoutInflater().inflate(R.layout.pexeso_keyboard, null);
keyboard = new Keyboard(this, R.xml.pexeso_keyboard_map);
kv.setKeyboard(keyboard);
kv.setPadding(10, 10, 10, 10);
kv.setOnKeyboardActionListener(this);
kv.invalidateAllKeys();
kv.setPreviewEnabled(false);
return kv;
}
..
..
..
}
现在它看起来是这样的: 我希望它看起来像这样: 如何调整布局以及什么是最佳解决方案?欢迎提出所有想法。