Y
Y
Yuri2019-07-28 20:55:00
Java
Yuri, 2019-07-28 20:55:00

How to add search menu in fragment?

Good day to all.
In the application I use NavigationDrawer. Toolbar I use custom. I switch fragments in the NavigationDrawer menu. The task is that when switching to a certain fragment, a list comes out (I already implemented it in RecyclerView). And a search menu should appear at the top of the Toolbar. It will search the list.
If all this is done in the Activity, then there are no questions.
I create menu.xml and in activity I create a menu through

@Override
    public boolean onCreateOptionsMenu(Menu menu) {
    }

But how to create a search menu in a fragment?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question