在此处查看 Android 文档:
https://developer.android.com/training/keyboard-input/style.html ,
具体来说:
EditText editText = (EditText) findViewById(R.id.search);
editText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
boolean handled = false;
if (actionId == EditorInfo.IME_ACTION_SEND) {
sendMessage();
handled = true;
}
return handled;
}
});
单击发送按钮后,这不会关闭键盘。handled
如果设置为 ,它也不会关闭键盘false
。
在这种情况下隐藏键盘的适当方法是什么?
看着 :-
在android中输入EditText后如何隐藏键盘?,似乎有很多种方法。这真的是Android的方式吗?