DEVELOPING AN ANDROID KEYBOARD: how can I change the background image of the key preview?
If you are creating your custom keyboard by extending KeyboardView then we can set a custom key preview layout to our custom KeyboardView using 'android:keyPreviewLayout' attr.
E.g.
<com.example.myApp.MyCustomKeyboardView
android:id="@+id/keyboard_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:keyPreviewLayout="@layout/my_custom_layout" />
where my_custom_layout.xml is your custom preview layout something like
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="80sp"
android:textSize="40sp"
android:textColor="?android:attr/textColorPrimaryInverse"
android:minWidth="32dip"
android:gravity="center"
android:background="@color/black"/>
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With