4

I'm implementing a navigationview in an Activity.When a navigationview item gets clicked a new fragment starts.My toolbar is defined in Activity and the problem is that i want to use different toolbars for each fragment.For example in one fragment the toolbar will contain a spinner, on another a couple of textviews etc.

What are my options here?I've thought of keeping the toolbar on Activity and inflate afterwards the views i need from fragment, but maybe there is a better approach?

tasgr86
  • 299
  • 2
  • 7
  • 17

1 Answers1

3

I answered a very similar question here:

How to use different Toolbars on each Fragment

It's basically all about:

1) Creating 1 XML for each different Toolbar

2) Including them on your main Activity XML

3) Showing and hiding the desired Toolbar on each Fragment

Hope that helps.

Community
  • 1
  • 1
herrmartell
  • 3,057
  • 4
  • 18
  • 27