Reputation: 793
Currently, I have developed an Activity
to show list of data using RecyclerView
with searching feature (as seen at image_1).
I want to add filtering option to the toolbar similar to the filter on the Youtube app (see image_2). Can anyone can give me clues to easily implement it? Both for the UI design and business logic.
Any idea how to implement the filter dialog window (see image_3)? Should I just use AlertDialog
or is there any other better options?
Upvotes: 8
Views: 8024
Reputation: 771
So, you need to create a options menu that starts a DialogFragment with a custom layout and get the tags filtered by the user in your dialog, then you can use them to filter your recyclerview.
Your adapter should implements Filterable interface!!
You can do it by following theses instructions:
Your adapter has to implements Filterable.
How to filter a RecyclerView with a SearchView
Upvotes: 2