Original: http://blog.csdn.net/wang_shaner/article/details/8467688
The case of "EditText + Button" forming an "input + keystroke response" is presented in the Android Programming is the most common.
But there are some details to be noted:
- After entering EditText, click Button to make the request, and the soft keyboard should disappear by itself.
- After entering EditText, instead of clicking Button to make a request, you can click "Enter" directly on the soft keyboard, so you should be able to respond to the request normally.
- InputMethodManager imm =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
- imm.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);