Search code examples
androidandroid-support-librarysearchviewandroid-actionbar-compat

SearchView causes action bar items, title, and launcher to disappear when I try to expand


I implemented a support v7 SearchView inside the ActionBar of a ListFragment. When that ListFragment is part of a master-detail screen on our Nexus 7, expanding it causes most of the action bar to disappear expanding it after replacing the detail fragment causes most of the action bar to disappear (I wanted to clarify here because I can successfully expand it when the screen is first loaded and before I select a new detail item in the master-detail list). This disappearance does not happen when the ListFragment is by itself in portrait. This problem has manifested itself only on our Nexus 7 running 4.3. To add to this strangeness, clicking another item in the master list causes yet more of the action bar to disappear.

The SearchView is inflated / configured from the master ListFragment. The Share icon is inflated / configured from the detail Fragment.

Edit: If I don't do anything to the SearchView programatically in onCreateOptionsMenu then it works fine. Of course, it has no functionality then.

Edit 2: My guess is that maybe something weird is happening when I change out detail fragments in master-detail and the SearchView is expanded. Perhaps some weird interaction with the different detail fragments' onCreateOptionsMenu invalidating while the SearchView is open.

Edit 3: I have also tried a custom collapsible action view rather than the SearchView and the issue is present. This means it has to do with the expanding / collapsing I think.

comparison


Solution

  • This problem sounds like its against caused by the same indirect problem as this SO post.

    Why my Android ActionBar doesn't update when it is explictily changed