编辑
Android强制隐藏和显示键盘
本文访问次数:0

强制显示键盘

private void showKeyBoard(EditText editText) {
    InputMethodManager manager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    manager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
}

强制隐藏键盘

private void hideKeyboard(EditText editText) {
    InputMethodManager manager = (InputMethodManager) getActivity().getSystemService(Service.INPUT_METHOD_SERVICE);
    manager.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}
没有任何评论