manager = (InputMethodManager)mActivity.getSystemService(Context.INPUT_METHOD_SERVICE);mActivity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);mEditText.setInputType(EditorInfo.TYPE_CLASS_TEXT);//输入类型 mEditText.setImeOptions(EditorInfo.IME_ACTION_SEARCH);//回车键类型 manager.showSoftInput(mEditText, 0);// 弹出键盘
/** * 隐藏软键盘 */ private void hideKeyboard() { if (mActivity.getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) { if (mActivity.getCurrentFocus() != null) manager.hideSoftInputFromWindow(mActivity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } }