creativecreatorormaybenot creativecreatorormaybenot - 1 year ago 110
Android Question

How do I remove the toolbar out of my android app?

The title basically says everything. I want to remove this:

from my application. I am using a tabbed activity.

What I already tried to do:

I tried to use

in my onCreate() method and I tried to change the style/theme of the app in my AndroidManifest.xml file.

This code in my tabbed app needs the toolbar(so I can't remove it from the layout):

Toolbar toolbar = (Toolbar) findViewById(;
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(;

TabLayout tabLayout = (TabLayout) findViewById(;

Answer Source

Use getSupportActionBar instead.

If you changed your apps style to not have the actionbar and you are setting a custom toolbar(through setSupportActionBar()), then you should be using getSupportActionBar() or your custom toolbar reference everytime you want to interact with it.

If you are using AppCompat that you have to always use getSupportActionBar() and you also have to use it if the API level is lower than 11.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download