How do you remove the back button from a v7 toolbar on Android?
I highlighted the button that I'm trying to remove in the image below:
How do I get rid of the back arrow on my Android toolbar? getActionBar(). setDisplayShowHomeEnabled(false); //disable back button getActionBar(). setHomeButtonEnabled(false); In a older android phone, the back button is removed with these two code lines.
Make a menu xml This is going to be in res/menu/main_menu . Right click the res folder and choose New > Android Resource File. Type main_menu for the File name. Choose Menu for the Resource type.
If you are using v7 Toolbar you can remove this button with this code :
if (getSupportActionBar() != null) {
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(false);
}
you can read android here and here for more information. also this question may help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With