抱歉,我尝试了很多方法并最终改变了主意。现在我将SearchView放在popupWindow中,我的新任务是当我点击键盘“搜索”按钮时如何使SearchView消失,(就像代码一样: SearchView.setVisiable(View.Gone));但如果我这样做,它将显示阴影而不是searchView
@覆盖
public boolean onQueryTextSubmit(String query){
searchView.clearFocus();
//searchView.setVisiable(View.Gone)
searchView.setQuery(query,false);
返回false;
}
@Override
public boolean onQueryTextChange(String newText) {
if (TextUtils.isEmpty(newText)) {
//clear filter
mListView.clearTextFilter();
} else {
//mListView.setFilterText(newText.toString());
mAdapter.getFilter().filter(newText);
}
return true;
}