I am strugling with removing this purple header from the android app. Tried following 2 solution, but none of them worked for me.
- Change the style -> parent in style.xml
<style name="Theme.MaxCogito" parent="Theme.AppCompat.Light.NoActionBar">
- Adding following code to onCreate() (this code actually broke my code) YouTube
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
getSupportActionBar().hide();
4
Answers
That "Purple bar" is called as the status bar. If you would like to hide it,
For
API_LEVEL < 16
For
API_Level >= 16
Your code doesn’t works because you API Level is newer than 16 (probably)
Add the following code inside
MainActivity
under theonCreate
method:This requests the OS to change the visibility of the status bar to be hidden.
In your onCreate method just add this
In Kotlin
In Java
}
Use that inside the styles of theme you are using.