//判断隐藏软键盘是否弹出 if (getWindow().getAttributes().softInputMode == WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) { //隐藏软键盘 InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(chatLayout.getWindowToken(), 0); }
原文:http://www.cnblogs.com/zzw1994/p/5267936.html