标签:
在开发中经常用到切换页面,需要关闭上个页面的软键盘,不加代码处理,系统是不会自动关闭的,影响用户体验。只需要在BaseActivity onPause()方法中调用一下方法:
//关闭输入法键盘,如果需要 if (getCurrentFocus() != null) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); }
标签:
原文地址:http://www.cnblogs.com/jaden/p/4599923.html