How to force to remove keyboard after shown with SHOW
I show keyboard with code
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))
.toggleSoftInput(InputMethodManager.SHOW_FORCED,
InputMethodManager.HIDE_IMPLICIT_ONLY);
etContent.requestFocus();
In next step I inflate new LinearLayout and call setContentView(newLayout) and keyboard is still there. How to force to remove keyboard ? I tried with
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
but it didn't help. Can somebody suggest me solution ?
Try this out. I've used this to hide the soft input a number of times.
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getContentView().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
试试这个,它应该工作
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getContentView().getWindowToken(), 0);
链接地址: http://www.djcxy.com/p/92976.html
上一篇: 如何在完成单击android中的EditText后保持键盘?
下一篇: 用SHOW显示后如何强制删除键盘