I have to press the backbutton twice, to close the SearchView
. Why? On the first press, the SearchView
only looses focus...
Setting setOnKeyListener
on SearchView
does not work either...
Btw, I'm using the ABS implementation...
My code is simple and looks like the following:
mMenuItemSearch = menu.findItem(R.id.search);
mSearchView = new SearchView(getSupportActionBar().getThemedContext());
mMenuItemSearch.setActionView(mSearchView);
mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener()
{
public boolean onQueryTextChange(String newText)
{
mPagerManager.getFragment(mSelectedPos).adapter.getFilter().filter(newText);
return true;
}
public boolean onQueryTextSubmit(String query)
{
return true;
}
});