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:

// If your minSdkVersion is 11 or higher, instead use:

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:

// If your minSdkVersion is 11 or higher, instead use:

PhD researcher at Friedrich-Schiller University Jena, Germany. I'm a physicist specializing in computational material science. I write efficient codes for simulating light-matter interactions at atomic scales. I like to develop Physics, DFT and Machine Learning related apps and softwares from time to time. Can code in most of the popular languages. Like to share my knowledge in Physics and applications using this Blog and a YouTube channel.
[wpedon id="7041" align="center"]

Leave a Reply

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