//Here is my fragment
<RelativeLayout android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white">
<RelativeLayout
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="@dimen/_420sdp"
android:background="#EAEAEA"
>
<RelativeLayout
android:id="@+id/home_bg_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/_400sdp"
android:background="@drawable/sama">
<Button
android:id="@+id/bookAppointmentBtn"
android:layout_width="match_parent"
android:layout_height="@dimen/_55sdp"
android:layout_marginLeft="@dimen/_30sdp"
android:layout_marginRight="@dimen/_30sdp"
android:fontFamily="@string/roboto_light"
android:textSize="@dimen/_20sdp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/_10sdp"
android:background="@drawable/book_appointmentbg"
android:textColor="@color/white"
android:text="@string/bookappointment" />
</RelativeLayout>
</RelativeLayout>
<Button
android:id="@+id/ContactNoBtn"
android:layout_width="match_parent"
android:layout_height="@dimen/_46sdp"
android:text="@string/shop_number"
android:textColor="#ffffff"
android:textSize="@dimen/_25sdp"
android:layout_below="@+id/discountsTv"
android:textAllCaps="false"
android:layout_marginRight="@dimen/_30sdp"
android:layout_marginTop="@dimen/_5sdp"
android:layout_marginLeft="@dimen/_30sdp"
android:background="@drawable/black_background"/>
<LinearLayout
android:id="@+id/servicesLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:layout_marginLeft="@dimen/_20sdp"
android:layout_marginRight="@dimen/_20sdp"
android:orientation="horizontal"
android:layout_below="@+id/servicesupperview"
>
<LinearLayout
android:id="@+id/menLayout"
android:layout_width="@dimen/_108sdp"
android:layout_height="@dimen/_27sdp"
android:layout_margin="@dimen/_10sdp"
android:layout_weight="1"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@string/roboto_medium"
android:textColor="#535353"
android:layout_marginStart="@dimen/_17sdp"
android:layout_marginTop="@dimen/_5sdp"
android:textSize="@dimen/_12sdp"
android:text="@string/mens"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/womenLayout"
android:layout_width="@dimen/_108sdp"
android:layout_height="@dimen/_27sdp"
android:layout_margin="@dimen/_10sdp"
android:layout_weight="1"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@string/roboto_medium"
android:textSize="@dimen/_12sdp"
android:layout_marginStart="@dimen/_10sdp"
android:layout_marginTop="@dimen/_5sdp"
android:textColor="#535353"
android:text="@string/womens"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/childrenLayout"
android:layout_width="@dimen/_108sdp"
android:layout_height="@dimen/_27sdp"
android:layout_margin="@dimen/_10sdp"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/_12sdp"
android:fontFamily="@string/roboto_medium"
android:textColor="#535353"
android:layout_marginStart="@dimen/_20sdp"
android:layout_marginTop="@dimen/_5sdp"
android:text="@string/children_caps"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
I am having toolbar in MainActivity
. This is my fragment i want to set title, image and back button inside the toolbar. Here i am using bottom navigation to change the fragments. Each and every fragment i want to set different title and image. I have to set title as center of the toolbar and back button as right corner of the toolbar.