When you use multiple fragments for one activity, you sometimes want to use different toolbars for each fragment. Only one toolbar is defined in activity, and how to customize and write in each fragment, and the toolbar is defined for each fragment
((AppcompatActivity)context).Which is common: setSupportActionbar (toolbar);
?
Or is there any other way?
Well, there's a way to write fragments like that. In my case, I just make a toolbar in Activity Sometimes the contents of the toolbar should be different, and so on. (Honestly, I didn't know how to do it differently.)<<) much..
So I did this
<android.support.v7.widget.Toolbar
android:background="@color/colorPrimary"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_gravity="center"
android:textStyle="bold"
android:text="Train Inquiry"
android:textSize="28dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageButton
android:layout_gravity="left"
android:background="@drawable/ic_menu_white_24dp"
android:layout_width="48dp"
android:layout_height="48dp"/>
</android.support.v7.widget.Toolbar>
If you do this, it looks like the picture below
As you can see, the toolbar is created... I believe that it will be possible to modify the contents to some extent, so then...<
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
578 Understanding How to Configure Google API Key
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.