读书人

暗藏键盘的一种处理方法

发布时间: 2013-10-22 16:17:03 作者: rapoo

隐藏键盘的一种处理方法

通过调用系统服务来隐藏键盘的一种处理方法:

// 获取InputMethodManager实例InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);if (inputMethodManager != null) {// 获取当前Focus的ViewView currentFocus = getCurrentFocus();if (currentFocus != null) {// 隐藏键盘inputMethodManager.hideSoftInputFromWindow(currentFocus.getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);}}

?

?

读书人网 >移动开发

热点推荐