Create different toolbars on different fragments in one exercise

I have some task to create one action with two fragments. In the first fragment there is a simple toolBar with a title and one user button at the end (ImageView), in the second I need a back button, search with functionality and a name. What is the best way to implement this? Create a toolBar in action and change it depending on the status or create a toolbar in each fragment? If someone already has such an implementation in the code, I will be grateful for watching it.

thank

+4
source share
1 answer

In your fragments, in onCreate()call setHasOptionsMenu()and implement the method onCreateOptionsMenu().

. " " http://developer.android.com/guide/components/fragments.html

+1

All Articles