Tzahie Leibovich
Tzahie Leibovich

Reputation: 131

android.support.v7 Toolbar & DrawerLayout- how to change Hamburger icon

My application uses ActionBarActivity and DrawerLayout and etc. i want to change the ActionBarDrawerToggle icon to be custom drawable.

in my code i use android.support.v7.widget.Toolbar as SupportActionBar

this is my code:

 toolbar.setNavigationIcon(R.drawable.lifeline_shield);
 setSupportActionBar(toolbar);
 ActionBar actionbar = getSupportActionBar();
 actionbar.setDisplayHomeAsUpEnabled(true);
 actionbar.setDisplayShowTitleEnabled(false);

mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.somestring1, R.string.somestring2) ....

but still i see the Hamburger icon, so i have my own icon for opening the drawer. How can I solve this? without using deprecated api

Upvotes: 1

Views: 6165

Answers (1)

Čikić Nenad
Čikić Nenad

Reputation: 392

Possible workaround:

mDrawerToggle.setDrawerIndicatorEnabled(false);
mDrawerToggle.setHomeAsUpIndicator(yourdrawableres);

Upvotes: 7

Related Questions