好的,这个问题已经被问过很多次了,我查看了很多相关主题但是我无法使它工作。
我的searchView
不在操作栏上,因此我无法使用collapseActionView()
我尝试过
searchView.clearFocus();//this closes the keyboard but does not remove focus
getActivity().getCurrentFocus().clearFocus(); //basically the same as above
searchView.setQuery("", false); //this clears the query and drops the keyboard
searchView.setIconified(true); // but the search retains focus and keyboard pops up again
无论我尝试什么,选中
searchView
后都无法取消焦点。