我想在按下按钮的事件中隐藏键盘。 任何帮助将不胜感激
隐藏虚拟键盘:
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editView.getWindowToken(), 0);
InputMethodManager inputManager = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
我将在 onClick(View v) 事件之后放置这个代码。
你需要导入 android.view.inputmethod.InputMethodManager;
当你点击按钮时,键盘会隐藏。