How to dismiss keyboard in Android SearchView?

后端 未结 15 1396
萌比男神i
萌比男神i 2020-12-05 06:27

I have a searchView in the ActionBar. I want to dismiss the keyboard when the user is done with input. I have the following queryTextListener on the searchView



        
15条回答
  •  佛祖请我去吃肉
    2020-12-05 06:53

    In a tablet app I'm working on with a dual pane activity, I've wrote only

    f.getView().requestFocus(); // f is the target fragment for the search

    and that was enough to dismiss the soft keyboard after a search. No need to use InputMethodManager

提交回复
热议问题