我要从键盘弹出窗口中选择键,而不是单击鼠标键,而是单击时。 enter image description here
当我在弹出菜单中未选择任何内容时,我尝试了此代码,但在键入和工作后将消失,但是当我从弹出窗口中键入键时,我却无法工作。
keyboardView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if(motionEvent.getAction() == MotionEvent.ACTION_UP) {
keyboardView.closing();
}
return false;
}
});
这是我的onCreateInputView代码
keyboardView = (KeyboardView) getLayoutInflater().inflate(R.layout.keyboard_view, null);
keyboard = new Keyboard(this, R.xml.letters_small);
keyboardView.setKeyboard(keyboard);
keyboardView.setPreviewEnabled(false);
keyboardView.setOnKeyboardActionListener(this);