android - Hide/unhide toolbar menu -


i want can able hide/unhide programmatically toolbar menu.

because couldn't find information on net use next code remove menu toolbar:

toolbar mtoolbar = (toolbar) findviewbyid(r.id.toolbar); mtoolbar.getmenu().clear(); 

how can put programmatically?

i figure out next code hide menu:

 toolbar mtoolbar = (toolbar) findviewbyid(r.id.toolbar);  mtoolbar.getmenu().clear(); 

and next unhide:

toolbar mtoolbar = (toolbar) findviewbyid(r.id.toolbar); if (!mtoolbar.getmenu().hasvisibleitems()) {     getmenuinflater().inflate(r.menu.menu_activity, mtoolbar.getmenu()); } 

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -