setOnActionExpandListener cause searchview not to expand

239 views Asked by At

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;
    }
});
1

There are 1 answers

0
wakkow On

Try returning true in onMenuItemActionExpand. Per the comments in OnActionExpandListener:

return true if the item should expand, false if expansion should be suppressed.