2019년 10월 25일 금요일

How to hide the keypad in Android?

If you want to hide the keypad in Android, please use the following code.

private void hideKeypad() {
    // hide keypad
    final View view = getCurrentFocus();

    if (view != null) {
        final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }
}

댓글 없음:

댓글 쓰기