函数体
/**
* hide soft keyboard
* @param token
*/
private void hideSoftKeyBoard(IBinder token , Context context) {
if (token != null) {
InputMethodManager im = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
im.hideSoftInputFromWindow(token,
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
调用方法
hideSoftKeyBoard(view.getWindowToken() , view.getContext()); //view为焦点所在的控件
网友评论