I am using SearchView
to provide search in an application. Everything works fine, except when I'm in the searchable activity and click on the search button.
This is when opening the SearchableActivity
(ok):
This is what happens if I click on the search button to initiate a new search (not ok):
As you can see the style of the ActionBar changes (both action bar and suggestion dropdown), it looks like when the action mode is enabled, and I don't have idea why this is happening.
And now I click back or up button, the ActionBar is reset to initial style (what should I get when clicking on the search button):
Any help is appreciated. Thank you.
The issue was caused because in the SearchableActivity
I was intercepting the search button and calling onSearchRequested()
:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_search:
onSearchRequested();
return true;
default:
return false;
}
}
There's no need for onOptionsItemSelected()
to be overrided, deleteting this piece of code solved the issue.