public void hideSoftInput(Activity activity) { // 关闭软键盘 if (activity.getCurrentFocus() != null) { if (activity.getCurrentFocus().getWindowToken() != null) { InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS); } } }
相关文章
- 06-06android-隐藏相机预览,但仍接收预览回调
- 06-06如何在Android中的ListView上隐藏过滤器弹出窗口?
- 06-06隐藏Android软键盘(如果已打开)
- 06-06在Android中设置textIsSelectable(true)后,软键盘无法打开
- 06-06android – 在三星设备上对话后关闭软键盘
- 06-06android-如何防止软键盘出现在触摸屏上
- 06-06如何在Android中隐藏无键盘的软键盘?
- 06-06android – 如何在EditText上的OK键上隐藏软键盘并再次显示它
- 06-06android-软键盘在棒棒糖版本中隐藏EditText
- 06-06更改声音/单击软键盘-android