hide keyboard in Android
This question already has an answer here:
You can hide the virtual keyboard using the InputMethodManager , calling hideSoftInputFromWindow
, passing in the token of the window containing your view.
View view = this.getCurrentFocus();
if (view != null) {
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
You will need context to for initiating the InputMethodManager
and then you can use this code for the view you want.
上一篇: createScaledBitmap的过滤参数有什么作用?
下一篇: 在Android中隐藏键盘