InputMethodManager manager = (InputMethodManager) mContext
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (((Activity) mContext).getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
manager.hideSoftInputFromWindow(((Activity) mContext).getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
原文地址:http://www.cnblogs.com/yuanyuan-5683/p/3862584.html