I am working on soft keyboard. I had done with all of my functionality.
But now i just need to change view of key preview when key is
pressed. Currently my key preview is shown(default sample keyboard key
preview) like shown in below image,
As we can see character 'd' is popped up when key is pressed.
But now i need customize it. As currently key preview background is
white, i need it to set green color just like shown below,
I have the sample keyboard code, but couldn't find the place where it
show a popout letter. So i can easily edit it customize it my own way.
I googled for help nothing found any help any. Any help is
appreciated.
Use something like this in your keys XML layout:
<Key android:codes="97" android:keyIcon="@drawable/key_icon" android:iconPreview="@drawable/key_preview_icon" />
It worked for me. I hope this helps you :)
You may have created a android.inputmethodservice.KeyboardView.xml
layout resource file
Use android:keyBackground="#FF419F3C"
<?xml version="1.0" encoding="utf-8"?>
<android.inputmethodservice.KeyboardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:id="@+id/keyboard"
android:labelTextSize="20dp"
android:background="@color/colorTrybg"
android:keyTextColor="@color/colorTrykey"
<!-- This one -->
android:keyBackground="#FFFFFF"
android:layout_alignParentBottom="true"
android:keyPreviewLayout="@layout/preview">
</android.inputmethodservice.KeyboardView>