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
  • 2,801
  • 2
  • 24
  • 37
Samadi Ilias
  • 139
  • 1
  • 1
  • 4

1 Answers1

32

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
  • 8,594
  • 13
  • 57
  • 86
Mohammad Fatemi
  • 1,238
  • 2
  • 12
  • 16