/Android-SearchView-Demo

A demonstration application for android's SeachView.

Primary LanguageKotlin

Android SearchView Demo

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

enter image description here enter image description here

There is also an example of implementing a custom suggestion layout

enter image description here