How Do You Disable The Softkeyboard Key Preview Window?
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
Solution 1:
There's a method:
publicvoidsetPreviewEnabled(boolean previewEnabled)
But I don't know which version of the API that starts at.
Solution 2:
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"
/>
Solution 3:
Have you tried this:
publicstatic mEmptyView;
//somewhere where you have the context:
mEmptyView = newView(context);
@OverridepublicViewonCreateCandidatesView() {
return mEmptyView;
}
This basically will always return an empty view, when the candidates should show up.
Solution 4:
If you want to handle Preview for Particular Keys means handle it inside onPress Method.
overridefunonPress(primaryCode: Int) {
handleKeyPreviews(primaryCode)
}
privatefunhandleKeyPreviews(code: Int) {
when (code) {
Keyboard.KEYCODE_DELETE, Keyboard.KEYCODE_SHIFT, Keyboard.KEYCODE_DONE, 32 ->
keyboardView?.isPreviewEnabled = falseelse ->
keyboardView?.isPreviewEnabled = true
}
}
Post a Comment for "How Do You Disable The Softkeyboard Key Preview Window?"