I've been struggling with this for weeks.. I have a global search that offers up a custom listview with suggestions as a user types. When a user selects an option, I want the searchview to return to its completely collapsed state.

Instead, it shrinks down but stays in a slightly expanded view.

I've thrown EVERYTHING I can find at this thing to close it, but cannot for the life of me get the right method. Here's the function:
    final SearchView.OnCloseListener closeListener = new SearchView.OnCloseListener() {          @Override         public boolean onClose() {             return closeSearch();         }     };      protected boolean closeSearch() {     _searchView.clearFocus();     _searchView.setQuery("", false);     _searchView.setFocusable(false);     _searchMenuItem.collapseActionView();     isSearchFragmentVisible(false);     return false; }   Close search is then manually called when an item is selected from the custom "suggestion" listview.
Instead of calling _searchView.onActionViewCollapsed() call menuItem.collapseActionView() where _searchView = menuItem.getActionView().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With