In my app, I use a MainActivity for storing the main layout (DrawerLayout, with a CoordinatorLayout as content root, with the toolbar and fragment holder in it), and various fragments as screens.
On one particular screen I'd like to expand the ActionBar to a certain size, and give it specific content (remove the toggle button, menu bar, etc., and specify my own layout). It is done by MainActivity.toolbar.setCustomView();
. It works pretty well, however when I navigate to a different fragment, I'd like to restore the original layout. Is there a simple way of doing this?