Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change ActionBarDrawer toggle icon when using v7 library

I want to use a custom image in place of the default icon used to toggle the navigation drawer in android. How do I go about it? Here is an image of what I want to change. enter image description here

like image 903
mungaih pk Avatar asked Sep 09 '15 18:09

mungaih pk


2 Answers

Use below code 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);
        }
});
like image 104
vishal jangid Avatar answered Sep 29 '22 01:09

vishal jangid


you can change with style.xml

 <style
    name="BaseTheme" parent="Theme.AppCompat.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="homeAsUpIndicator">@drawable/menu</item>
    <item name="android:textColorPrimary">@android:color/white</item>
</style>
like image 28
Arya Avatar answered Sep 29 '22 01:09

Arya