BarmanInfo
BarmanInfo

Reputation: 392

Hamburger Icon Not showing

When I use to change Hamburger Icon to Back Icon while add a new fragment it's Perfectly working. Here is my code

supportActionBar!!.setDisplayHomeAsUpEnabled(true)
supportActionBar!!.setDisplayShowHomeEnabled(true) 

But when I press back button and close the fragment then it not change to hamburger icon

supportActionBar!!.setDisplayHomeAsUpEnabled(false)
supportActionBar!!.setDisplayShowHomeEnabled(false) 

NOTE: I dont have drawer layout. I use this library: yarolegovich/SlidingRootNav

Upvotes: 1

Views: 1483

Answers (1)

Yash Soni
Yash Soni

Reputation: 456

This is expected behaviour, it won't automatically change when you are doing: actionBar.setDisplayHomeAsUpEnabled(true);

One solution would be to handle it for yourself. Just change the icon manually actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(R.drawable.back);

and on back pressed, change it to hamburger icon: actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(R.drawable.hamburger_icon);

Hope this helps. Cheers.

Upvotes: 2

Related Questions