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();
Ph.D. 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 software from time to time. Can code in most of the popular languages. I like to share my knowledge in Physics and applications using this Blog and a YouTube channel.