10

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:

enter image description here

Josh Correia
  • 3,807
  • 3
  • 33
  • 50
Samadi Ilias
  • 139
  • 1
  • 1
  • 4

1 Answers1

34

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

shareef
  • 9,255
  • 13
  • 58
  • 89
Mohammad Fatemi
  • 1,278
  • 2
  • 12
  • 16