This is a small demonstration of how I managed to get the Android SearchView widget working nice. If you have been going mad trying to make the SearchView's autocomplete dropdown look nice with a dark action bar then this code will help.
This is a standalone app supporting android versions 14 -> 28 featuring:
- Proper material theme styling of the search view
- How to wire up the search view to a ContentProvider
- How to use the SearchRecentSuggestionsProvider
- How to programmatically close the SearchView when the back button is pressed
- How to programmatically close the SearchView without weird highlighting of the actionBar
There is also an example of implementing a custom suggestion layout