How Do I Use a Different Toolbar for Different Fragments in a Single Activity in Android?
Contents How Do I Change the Toolbar Name in Fragment? You Call getActivity(). setTitle(“Title”), but in This Case You Need to Attach Your Toolbar to the...
Contents
How do I change the toolbar name in fragment?
you call getActivity(). setTitle(“Title”) , but in this case you need to attach your Toolbar to the ActionBar by calling the setSupportActionBar() in your activity. You can have a public instance of your Toolbar and access that instance from the fragment.
How do I get a fragment toolbar?
To do this, call setHasOptionsMenu(true) in the onCreate() method of the fragment. The Android framework calls in this case the onCreateOptionsMenu() method in the fragment class. Here the fragment can adds menu items to the toolbar.