How to change the file menu that is being used in Android Menu Navigation Drawer?

Asked

Viewed 98 times

1

I want to know if it is possible to change the menu file being used by Drawer navigation menu inserir a descrição da imagem aqui Example: When entering this if that is in blue, it must be selected to use another menu file in the Drawer navigation menu. Is that really possible? If yes, how to do it? -If not, there is a good solution to do this?

  • If I understand correctly: you want to change what is displayed on Rawer by clicking on one of your items?

  • that’s exactly what it is

  • Hello, @Fabiocorder, why unchecked as answered? have any error in the answer? If you want to define better I can correct the answer.

1 answer

0


There is a way, but depending on what you intend to do I do not know if it would be usable, because it also closes the Navigation Drawer, but going on...

It is possible to change the file that is being used by Navigation Drawer, first you "clean" the menu being used with the method Clear() and then inflates the new menu:

navView.getMenu().clear(); //limpa o menu inflado (e fecha o navigation drawer)
navView.inflateMenu(R.menu.menu_nav); //infla o novo menu

If that’s not what you want, you can detail a little more than you need.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.