Android show and hide ime implementation code
- 2020-05-09 19:20:18
- OfStack
// Hide the input method
InputMethodManager imm = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
// Show or hide the input method
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
toggleSoftInput
This method converts the display state of the software input method in the form. If the input method is currently in display state, the method sets the input method hide. If the input method is currently hidden, the method sets the input method display.