How to hide/show action bar programatically? [SOLVED] – Android Studio


To Hide/Show the action bar of your activity on Android Devices with API>11, just use the following codes:

To Hide the action bar:

getSupportActionBar().hide();
// If your minSdkVersion is 11 or higher, instead use:
//getActionBar().hide();

You can add the code inside the onCreate method if you don’t want the action bar to be shown at all, or if you want it to happen at the click of a button then you can paste it inside the OnClickListener of the button.

To Show the action bar:

getSupportActionBar().show();
// If your minSdkVersion is 11 or higher, instead use:
//getActionBar().show();

[wpedon id="7041" align="center"]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.