You can use custom toolbars in your fragments. and you have to implement them separately for each fragment. First of all declare your toolbar in your fragment layout :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:gravity="start"
android:minHeight="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
>
<RelativeLayout
// your custom toolbar layout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
</android.support.v7.widget.Toolbar>
Then implement it in your fragment:
find it in fragment:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle
savedInstanceState) {
View view = inflater.inflate(R.layout.fragment, container, false);
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
//set toolbar appearance
toolbar.setBackground(your background);
//for create home button
AppCompatActivity activity = (AppCompatActivity) getActivity();
activity.setSupportActionBar(toolbar);
activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
return view;
}
And yes you can implement click listeners and whatever you want to do with your toolbar. For more take a look at the second answer:
How to get custom toolbar