danishajaib
1/15/2019 - 11:28 AM

Setting ActionBar with Home Button

  
  myToolbar = findViewById(R.id.my_toolbar_stack);

  setSupportActionBar(myToolbar);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  myToolbar.getNavigationIcon().setColorFilter(getResources().getColor(R.color.navigation_icon_color), PorterDuff.Mode.SRC_ATOP);
<android.support.v7.widget.Toolbar
            android:id="@+id/my_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            android:elevation="4dp"
            android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:title="@string/app_name"
            app:titleTextColor="#ffffff"
            app:collapseIcon="@drawable/back_arrow_icon">

        </android.support.v7.widget.Toolbar>