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);
}
}

猜你喜欢

转载自www.cnblogs.com/Dorr/p/8986065.html
今日推荐