3

In my activity I want to change the drawer toggle icon I have my toolbar

 <android.support.v7.widget.Toolbar
    android:id="@+id/tool_bar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="@color/appColor"
    android:minHeight="?attr/actionBarSize"
    app:theme="@style/MyDarkToolbarStyle">


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

This is the toolbar theme

 <style name="MyDarkToolbarStyle" parent="Widget.AppCompat.Toolbar">
    <item name="android:gravity">center_vertical</item>
    <!--<item name="popupTheme">@style/PopupMenuStyle</item>-->
    <item name="actionButtonStyle">@style/MyActionButtonStyle</item>

</style>

This is the activity theme

 <style name="MyMaterialTheme.Base" parent="Theme.AppCompat">
    <item name="android:windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">@color/ColorPrimary</item>
    <item name="colorPrimaryDark">@color/ColorPrimaryDark</item>
</style>
WISHY
  • 11,067
  • 25
  • 105
  • 197
  • Is this http://stackoverflow.com/questions/27028571/how-to-replace-the-hamburger-icon-used-for-actionbartoggle-on-android-toolbar-wi helps you? – Pankaj Kumar Apr 30 '15 at 06:39

1 Answers1

31

Use below code snippet to set your custom actionbar toggle button.

  mDrawerToggle.setDrawerIndicatorEnabled(false);

            // mDrawerToggle.setHomeAsUpIndicator(R.drawable.menu_icon);
            mToolbar.setNavigationIcon(R.drawable.menu_icon);

            mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mDrawerLayout.openDrawer(Gravity.LEFT);
                }
            });
Kirankumar Zinzuvadia
  • 1,249
  • 10
  • 17