Shahal
Shahal

Reputation: 1070

Custom Hamburger icon with Navigation Component

I'm using new Navigation Component in my project. I created a custom Toolbar which will keep the Title in the centre even when having navigation drawer.

This is how my toolbar looks now. enter image description here enter image description here

I'm trying to put a custom hamburger and back icon there(basically i need white icons).

I've tried

dataBinding.appBarHome.toolbar.setNavigationIcon(ContextCompat.getDrawable(this, R.drawable.ic_hamburger));

getSupportActionBar().setHomeAsUpIndicator(ContextCompat.getDrawable(this,R.drawable.ic_hamburger));

None of it is working. if want to see any specific part of my code, feel free to ask.

Upvotes: 2

Views: 487

Answers (1)

Dhaval Solanki
Dhaval Solanki

Reputation: 4705

Maybe it just because of style or them, Just try with bellow style

ThemeOverlay.AppCompat.Dark.ActionBar

When every you choose dark action bar then default icon color should be white and when you select an action bar then it will be the black icon

So just replace style in your manifest or style.xml

Upvotes: 3

Related Questions