Android has a built in SearchView component but it doesn’t feel much like Material Design. This has even been asked on StackOverflow because developers are having trouble recreating the same MaterialSearchView that appears in many of Google’s applications. However, thanks to one of my good friends Maurício you can now implement this great component in your own projects!
The MaterialSearchView library that he wrote provides a Material Design overlay for your screen that includes an EditText for searching, along with a ListView to show some items, typically recent or suggested searches. It supports both text input and voice input searches. Let’s take a look at the sample:
You’ll notice three really great things about this sample:
- A beautiful open and close animation.
- The ListView is prepopulated with recent searches.
- The ListView automatically updates to show the filtered and suggested searches based on user input.
The MaterialSearchView is supported with a min SDK of 14. For information on how to include it in your project, as well as more details on the functionality of the library, please see the linked repository above.