Hide Android keyboard key preview

前端 未结 2 987
误落风尘
误落风尘 2021-01-04 13:38

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 keyboar

相关标签:
2条回答
  • 2021-01-04 14:00
    public void onPress(int primaryCode) {
         mInputView.setPreviewEnabled(false);
    }
    
    public void onRelease(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

        private KeyboardView mInputView;
        @Override
        public KeyboardView onCreateInputView() {
            mInputView = (KeyboardView)getLayoutInflater().inflate(R.layout.keyboard, null);
            mInputView .setPreviewEnabled(false);
            return mInputView;
        }
    
    0 讨论(0)
  • 2021-01-04 14:21

    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.

    0 讨论(0)
提交回复
热议问题