Can I use the toolbar/app bar in multiple activities/screens without writing adding individually in each screen?

I am developing an app and I am using the material design app bar and I want to use that single toolbar/app bar which I have declared in the main activity to each activity in my app.

1 answer

  • answered 2021-06-10 11:05 Venkatesh Talacheeru

    You can specify whether you need a toolbar or not in your styles.xml file

    <style name="MaterialAppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
            <!-- Customize your theme here. -->
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorAccent">@color/colorAccent</item>
        </style>