When creating your own SoftKeyboard you are given a "key preview" by default.
How do you disable this?
Edit:
You can customise the keyPreview
layout by changing the <KeyboardView>
attribute android:keyPreviewLayout
. This is styled by default to look at keyboard_key_preview.xml:
Edit 2: Following my be a red herring:
The source code suggests supplying 0 or not applying the tag android:keyPreviewLayout
will result in no key preview appearing:
...
case com.android.internal.R.styleable.KeyboardView_keyPreviewLayout:
previewLayout = a.getResourceId(attr, 0);
break;
...
if (previewLayout != 0) {
mPreviewText = (TextView) inflate.inflate(previewLayout, null);
mPreviewTextSizeLarge = (int) mPreviewText.getTextSize();
mPreviewPopup.setContentView(mPreviewText);
mPreviewPopup.setBackgroundDrawable(null);
} else {
mShowPreview = false;
}
I've tried:
keyPreviewLayout
reference an id with a value of 0 (which causes a crash on inflation). Stumped. :( Any help would be greatly appreciated!
There's a method:
public void setPreviewEnabled(boolean previewEnabled)
But I don't know which version of the API that starts at.
Another way - add to xml
android:keyPreviewLayout="@null"
<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:keyPreviewLayout="@null"
android:visibility="gone"
/>
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