How to set XML fullscreen in Android

Afaik you can't do fullscreen in xml. You have two choices:

  1. AndroidManifest.xml in activity's section
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
  1. in onCreate() before calling setContentView
requestWindowFeature( Window.FEATURE_NO_TITLE );

getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN,
                      WindowManager.LayoutParams.FLAG_FULLSCREEN );

As the other answer doesn't work for me:


<style name="AppTheme.Fullscreen">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>
</style>

Add this style to your styles.xml


<activity
    android:name=".TitlesActivity"
    android:theme="@style/AppTheme.Fullscreen">

Make sure your activity in the AndroidManifest.xml refers to your theme.

Tags:

Xml

Android