当搜索提交隐藏键盘,或选择了搜索建议 [英] Hide keyboard when a search is submitted or a search suggestion is chosen
本文介绍了当搜索提交隐藏键盘,或选择了搜索建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个操作栏搜索插件,提供搜索建议了。当在查询的用户类型和提交,或选择一个搜索建议,键盘不会消失。我怎样才能解决这个问题?
I have a action bar search widget that offers search suggestion too. When the user types in a query and submits it or chooses a search suggestion, the keyboard doesn't disappear. How can I resolve this issue?
我一直无法弄清楚如何隐藏在搜索键盘提交或建议进行选择。
I haven't been able to figure out how to hide the keyboard upon search submit or suggestion choose.
感谢您。
推荐答案
要隐藏输入法编辑器,使用 InputMethodManager
:
To hide the input method editor, use InputMethodManager
:
InputMethodManager imm=
(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
您可以使用此从 onEditorAction()
,例如,如图的此示例项目。
You can use this from onEditorAction()
, for example, as shown in this sample project.
这篇关于当搜索提交隐藏键盘,或选择了搜索建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文