android键盘相关

/**
* 隐藏软键盘(只适用于Activity,不适用于Fragment)
*/
private void hideSoftKeyboard(Activity activity) {
View view = activity.getCurrentFocus();
if (view != null) {
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}
posted @ 2018-05-03 16:29  嗨Dorr  阅读(107)  评论(0编辑  收藏  举报