This question already has an answer here:
- Close/hide the Android Soft Keyboard 96 answers
I have two EditText Views and a Button in Linearlayout. After Completion of writing in the edittext, I want to hide the Android Virtual keyboard, How can I do that?
Lucifer
You may use the InputMethodManager class like this:
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow( yourEditText.getWindowToken(),InputMethodManager.RESULT_UNCHANGED_SHOWN);
来源:https://stackoverflow.com/questions/22404302/how-to-hide-android-soft-keyboard