AndroidManifest.xml<activity
android:name=".GenerateInvoice"
android:theme="@style/noActionBar"
android:parentActivityName=".Dashboard"/>Style.xml<!-- Dash Board . -->
<style name="Dashboard" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorLightBlue</item>
<item name="colorPrimaryDark">@color/colorDashboard</item>
</style>
Create file res/layout/toolbar_actionbar.xml
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="@+id/custom_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorLightBlue"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:title="@string/menu_history"
app:titleMarginStart="@dimen/toolbar_title_Spacing"
app:titleTextColor="@color/colorWhite" />
</com.google.android.material.appbar.AppBarLayout>Layout_Activity.javaToolbar toolbar = (Toolbar) findViewById(R.id.custom_tool_bar);
setSupportActionBar(toolbar);//-----upEnable Button----//getSupportActionBar().setDisplayShowHomeEnabled(true);getSupportActionBar().setDisplayHomeAsUpEnabled(true);Include in layout of your activity(for me it
layout_my_activity.xml)<include layout="@layout/custom_toolbar" />ScreenShot:

Comments
Post a Comment