In my code I write:
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.setContentView(R.layout.activity_main);
I've written all of it before the setContentView()
call is made but it doesn't work.
I've already used the theme in android studio to remove the title bar and set the app to fullscreen but nothing changed.
How can I remove or hide the title bar that shows by default, when developing an android app?
1. Create a new style definition in your styles.xml
file and make it a child of Theme.AppCompat.Light.NoActionBar
.
For example:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
2. Add the new style definition to your application tag in the AndroidManifest.xml
file
<application
...
android:theme="@style/AppTheme">
Add the following properties to a new or existing style definition in the styles.xml
file and ensure the style definition has been referenced in the AndroidManifest.xml
file, as above:
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
go to values and select styles.xml change AppTheme to
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With