Using setOnActionExpandListener
causes SearchView
not to expand. Why? And how can I fix it?
menu.findItem(R.id.action_search).setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem item) {
return false;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
//TODO
return true;
}
});
Try returning true in onMenuItemActionExpand. Per the comments in OnActionExpandListener: