I have added a SearchView to an ActionBar which filters a ListView.
Everything works fine, the only problem is when I write a query in the SearchView, the query text also appears in a box in the middle of the screen in big fonts.
I guess it is some kind of query preview.. How do I cancel this? I couldn't find anything in the documentation.
Thanks.
Try to change the way you implement onQueryTextChange. I comment listview.clearTextFilter(); and change that for ca.getFilter().filter(null);
Here is the code I used
@Override
public boolean onQueryTextChange(String newText) {
System.out.println("tap");
yourAdapter ca = (yourAdapter)listview.getAdapter();
if (TextUtils.isEmpty(newText)) {
System.out.println("isEmpty");
//listview.clearTextFilter();
ca.getFilter().filter(null);
} else {
ca.getFilter().filter(newText);
//listview.setFilterText(newText);
}
return true;
}