Skip to content Skip to sidebar Skip to footer

Hide Android Keyboard Key Preview

What I'm looking to do is hide only the popups that show what key you are currently pressing while using a soft keyboard. Is this possible? I am creating my own new keyboard which

Solution 1:

After reading a little bit of the actual android keyboard source code:

What I was referring to was the "key preview", which is "a popup that shows a magnified version of the depressed key." By default the preview is enabled, but to disable it, simply enough, is setPreviewEnabled(boolean previewEnabled). Which is a method from the KeyboardView class. API.

Solution 2:

publicvoidonPress(int primaryCode){
     mInputView.setPreviewEnabled(false);
}

publicvoidonRelease(int primaryCode){
    mInputView.setPreviewEnabled(true); //Change to false if you want remove too for the Del key when it's pressed
}

Additionally, To get the view and universally disable the preview from within a custom class extending InputMethodService

privateKeyboardView mInputView;
    @OverridepublicKeyboardViewonCreateInputView() {
        mInputView = (KeyboardView)getLayoutInflater().inflate(R.layout.keyboard, null);
        mInputView .setPreviewEnabled(false);
        return mInputView;
    }

Post a Comment for "Hide Android Keyboard Key Preview"