-5

I want to change Hamburger Icon and replace it with any other custom Icon. How can I achieve this? Is it feasible?

I have go with android.support.v7 Toolbar & DrawerLayout- how to change Hamburger icon but it doesn't work for me.

Community
  • 1
  • 1
jitendra
  • 209
  • 3
  • 11

2 Answers2

2

Try doing this

mToolbar.post(new Runnable() {
    @Override
    public void run() {
        Drawable d = ResourcesCompat.getDrawable(getResources(), R.id.your_drawable, null);
        mToolbar.setNavigationIcon(d);
    }
});
Michio
  • 297
  • 2
  • 7
  • It works on the MainActivity when starting up the app, but once you click into the navigation drawer menu, the toolbar changes back to the hamburger icon. – J0nathan Lam Mar 23 '20 at 05:25
1

Use this code

ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(this,
                 mDrawerLayout, null, your_drawable, your_drawable);

Refer this link: How to replace the hamburger icon used for ActionBarToggle on Android Toolbar with a custom drawable?

Or, you can use:

mDrawerToggle.setDrawerIndicatorEnabled(false);
mDrawerToggle.setHomeAsUpIndicator(drawable_name);
Community
  • 1
  • 1