I have followed this tutorial and created my own keyboard, but I can't change the background color for it's keys.
keyboard.xml
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="3px"
android:keyWidth="10%p"
android:keyHeight="60dp"
android:keyBackground="@color/color_green"
android:keyTextColor="@color/color_red"
android:verticalGap="3px">
keyboard_view.xml
<android.inputmethodservice.KeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/keyboard_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/all_white">
</android.inputmethodservice.KeyboardView>
MyInputMethodService.java
@Override
public View onCreateInputView() {
keyboardView = (KeyboardView) getLayoutInflater().inflate(R.layout.keyboard_view, null);
keyboardView.setPreviewEnabled(false);
keyboard = new Keyboard(this, R.xml.number_pad);
keyboardView.setKeyboard(keyboard);
keyboardView.setOnKeyboardActionListener(this);
return keyboardView;
}
I've tried change android:keyBackground
and android:keyTextColor
, but nothing changes, but if I change some key value in the same file it works.