0

I just created a new project in Android Studio and I choose Navigation Drawer Activity.

After I made few changes, I realized that I need to change this icon color into dark grey. because the action bar background will be white.

enter image description here

where this icon png file stored? thank you.

Saint Robson
  • 5,475
  • 18
  • 71
  • 118
  • 4
    Possible duplicate of [How to change color of hamburger icon in material design navigation drawer](http://stackoverflow.com/questions/31870132/how-to-change-color-of-hamburger-icon-in-material-design-navigation-drawer) – Ankush Bist Feb 17 '17 at 08:46
  • See this answer http://stackoverflow.com/a/42293785/4571925 – saurabh dixit Feb 17 '17 at 09:13

5 Answers5

2

If you want to change icon color,you need to change in style.xml

<style name="MyMaterialTheme" parent="MyMaterialTheme.Base">

</style>

<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
</style>

<style name="DrawerArrowStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
    <item name="spinBars">true</item>
    <item name="color">@android:color/red</item>
</style>

Java

 Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mToolbar.setTitle("title");
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true); 
    getSupportActionBar().setHomeButtonEnabled(true);
Aditya Vyas-Lakhan
  • 13,409
  • 16
  • 61
  • 96
2

You can change the color of the icon by applying custom theme for your toolbar.You can use the below for reference

<style name="MyMaterialTheme" parent="MyMaterialTheme.Base"/>

<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="drawerArrowStyle">@style/IconStyle</item>
</style>

<style name="IconStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
    <item name="spinBars">true</item>
    <item name="color">@color/your_desired_color</item>
</style>
Vivek Mishra
  • 5,669
  • 9
  • 46
  • 84
2

If you create new project and choose NavigationDrawerActivity. You can change icon drawer on NavigationDrawerFragment.class at line R.drawable.ic_drawer,

public void setUp(int fragmentId, DrawerLayout drawerLayout) {
    mFragmentContainerView = getActivity().findViewById(fragmentId);
    mDrawerLayout = drawerLayout;

    // set a custom shadow that overlays the main content when the drawer opens
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    // set up the drawer's list view with items and click listener

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);

    // ActionBarDrawerToggle ties together the the proper interactions
    // between the navigation drawer and the action bar app icon.
    mDrawerToggle = new ActionBarDrawerToggle(
            getActivity(),                    /* host Activity */
            mDrawerLayout,                    /* DrawerLayout object */
            R.drawable.ic_drawer,             /* nav drawer image to replace 'Up' caret */
            R.string.navigation_drawer_open,  /* "open drawer" description for accessibility */
            R.string.navigation_drawer_close  /* "close drawer" description for accessibility */
Nguyễn Trung Hiếu
  • 2,004
  • 1
  • 10
  • 22
2

You just need to call this for changing color of this navigation icon.

toolbar.getNavigationIcon().setColorFilter(Color.YourColor, PorterDuff.Mode.MULTIPLY);  
Community
  • 1
  • 1
saurabh dixit
  • 863
  • 6
  • 19
1

you can use above solution , but still if you want icons you can get it over here https://material.io/icons/#ic_menu , download the size and few colour you want

generally all the inbuilt icons will be in SDK folder

\sdk\platforms\android-23\data\res\drawable
Manohar
  • 22,116
  • 9
  • 108
  • 144