Actividad de Pantalla Completa en Android?


¿Cómo puedo hacer una actividad a pantalla completa? Quiero decir sin la barra de notificaciones. Alguna idea?

Author: Swati Garg, 2010-05-19

25 answers

Puedes hacerlo programáticamente:

public class ActivityName extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // remove title
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.main);
    }
}

O puede hacerlo a través de su archivo AndroidManifest.xml:

<activity android:name=".ActivityName"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>

Editar:

Si está utilizando AppCompatActivity, debe establecer el tema como se muestra a continuación

<activity android:name=".ActivityName"
    android:label="@string/app_name"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
 864
Author: Cristian,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-19 09:07:15

Hay una técnica llamada Modo Inmersivo de Pantalla Completa disponible en KitKat. Demostración Inmersiva del Modo de Pantalla Completa

Ejemplo

 113
Author: Dmide,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-04-25 18:19:28

Si no quieres usar el tema @android:style/Theme.NoTitleBar.Fullscreen porque ya estás usando un tema propio, puedes usar android:windowFullscreen.

En AndroidManifest.xml:

<activity
  android:name=".ui.activity.MyActivity"
  android:theme="@style/MyTheme">
</activity>

En estilos.xml:

<style name="MyTheme"  parent="your parent theme">
  <item name="android:windowNoTitle">true</item>
  <item name="android:windowFullscreen">true</item> 
</style>
 67
Author: Ariel Cabib,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-17 09:39:23

En AndroidManifest.archivo xml :

<activity
    android:name=".Launch"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" > <!-- This line is important -->

    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>  

O en Java código:

protected void onCreate(Bundle savedInstanceState){
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
 44
Author: iNFInite PosSibiLitiEs,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-02-21 12:26:09

Si usas AppCompat y ActionBarActivity, usa esto

getSupportActionBar().hide();

 25
Author: Bala Vishnu,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-01-22 14:50:31

Tenga cuidado con

requestWindowFeature(Window.FEATURE_NO_TITLE);

Si está utilizando cualquier método para establecer la barra de acciones de la siguiente manera:

getSupportActionBar().setHomeButtonEnabled(true);

Causará una excepción de puntero nulo.

 22
Author: jiahao,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-09-29 22:12:08

Prueba esto con appcompat desde style.xml. Se puede apoyar con todas las plataformas.

<!-- Application theme. -->
<style name="AppTheme.FullScreen" parent="AppTheme">
    <item name="android:windowFullscreen">true</item>
</style>


<!-- Application theme. -->
<style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar" />
 20
Author: Rohit Suthar,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-02-01 07:10:47

Usando Android Studio (la versión actual es 2.2.2 en este momento) es muy fácil agregar una actividad a pantalla completa.

Vea los pasos:

  1. Haga clic derecho en su paquete principal de java > Seleccione "Nuevo" > Seleccione "Actividad" > Luego, haga clic en "Actividad de pantalla completa".

Paso uno

  1. Personalice la actividad ("Nombre de la actividad", "Nombre del diseño", etc.) y haga clic en "finalizar".

Paso dos

Hecho!

Ahora tienes un actividad de pantalla completa hecha fácilmente (ver la clase java y el diseño de la actividad para saber cómo funcionan las cosas)!

 12
Author: Filipe de Lima Brito,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-11-02 20:33:18

Para aquellos que usan AppCompact... estilo.xml

 <style name="Xlogo" parent="Theme.AppCompat.DayNight.NoActionBar">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>

Luego pon el nombre en tu manifiesto...

 7
Author: X-Black...,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-09-01 15:53:06

Gracias por responder @ Cristian estaba recibiendo error

Android.útil.AndroidRuntimeException: requestFeature() debe ser llamada antes de añadir contenido

Resolví esto usando

@Override
protected void onCreate(Bundle savedInstanceState) {

    requestWindowFeature(Window.FEATURE_NO_TITLE);

    super.onCreate(savedInstanceState);

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

    setContentView(R.layout.activity_login);

    -----
    -----
}
 6
Author: Bikesh M Annur,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-11-27 07:11:26

Primero debe configurar el tema de la aplicación con" NoActionBar " como a continuación

<!-- Application theme. -->
<style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar" />

Luego agregue estas líneas en su actividad de pantalla completa.

public class MainActiviy extends AppCompatActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                                  WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.main);
    }
}

Ocultará actionbar / toolbar y también statusbar en su actividad de pantalla completa

 6
Author: Rajesh Peram,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-04-18 12:41:54

Quería usar mi propio tema en lugar de usar @android:style/Theme.NoTitleBar.Pantalla completa. Pero no estaba funcionando como había mencionado algún post aquí, así que hice algunos ajustes para averiguarlo.

En AndroidManifest.xml:

<activity
    android:name=".ui.activity.MyActivity"
    android:theme="@style/MyTheme">
</activity>

En estilos.xml:

<style name="MyTheme">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
</style>

Nota: en mi caso tuve que usar name="windowActionBar" en lugar de name="android:windowActionBar" antes de que funcionaba correctamente. Así que solo usé ambos para asegurarme de que en caso de que necesite portar a una nueva versión de Android más tarde.

 2
Author: Chef Pharaoh,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-02-22 17:02:01

AndroidManifest.xml

<activity ...
          android:theme="@style/FullScreenTheme"
    >
</activity>

I. El tema principal de tu aplicación es Theme.AppCompat.Luz.DarkActionBar

Para ocultar Barra de acción / Barra de estado
estilo.xml

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    ...
</style>

<style name="FullScreenTheme" parent="AppTheme">
    <!--this property will help hide ActionBar-->
    <item name="windowNoTitle">true</item>
    <!--currently, I don't know why we need this property since use windowNoTitle only already help hide actionbar. I use it because it is used inside Theme.AppCompat.Light.NoActionBar (you can check Theme.AppCompat.Light.NoActionBar code). I think there are some missing case that I don't know-->
    <item name="windowActionBar">false</item>
    <!--this property is used for hiding StatusBar-->
    <item name="android:windowFullscreen">true</item>
</style>

Para ocultar la barra de navegación del sistema

public class MainActivity extends AppCompatActivity {

    protected void onCreate(Bundle savedInstanceState) {
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
        setContentView(R.layout.activity_main)
        ...
    }
 }

II. El tema principal de tu aplicación es Theme.AppCompat.Luz.NoActionBar

Para ocultar Barra de acción / Barra de estado
estilo.xml

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    ...
</style>

<style name="FullScreenTheme" parent="AppTheme">
    <!--don't need any config for hide ActionBar because our apptheme is NoActionBar-->
    <!--this property is use for hide StatusBar-->
    <item name="android:windowFullscreen">true</item> // 
</style>

Para ocultar la navegación del sistema bar

Similar like Theme.AppCompat.Light.DarkActionBar.

Demo
Espero que ayude

 2
Author: Phan Van Linh,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-09-24 09:39:41

CONSEJO: Usando getWindow().setLayout() puede arruinar su pantalla completa! Nota la documentación para este método dice:

Establezca los parámetros de diseño de ancho y alto de la ventana... puedes cambiarlos a ... un valor absoluto para hacer una ventana que no es de pantalla completa.

Http://developer.android.com/reference/android/view/Window.html#setLayout%28int,%20int%29

Para mis propósitos, encontré que tenía que usar setLayout con absoluto parámetros para cambiar el tamaño de mi ventana de pantalla completa correctamente. La mayoría de las veces, esto funcionó bien. Fue llamado por un evento onConfigurationChanged (). Sin embargo, hubo un contratiempo. Si el usuario salía de la aplicación, cambiaba la orientación y volvía a entrar, provocaría el disparo de mi código que incluía setLayout(). Durante esta ventana de tiempo de reentrada, mi barra de estado (que estaba oculta por el manifiesto) volvería a aparecer, pero en cualquier otro momento setLayout() no causaría esto! La solución era agrega una llamada adicional a setLayout() después de la que tiene los valores duros como así:

       public static void setSize( final int width, final int height ){
//DO SOME OTHER STUFF...
            instance_.getWindow().setLayout( width, height );
            // Prevent status bar re-appearance
            Handler delay = new Handler();
            delay.postDelayed( new Runnable(){ public void run() {
                instance_.getWindow().setLayout(
                    WindowManager.LayoutParams.FILL_PARENT,
                    WindowManager.LayoutParams.FILL_PARENT );
            }}, FILL_PARENT_ON_RESIZE_DELAY_MILLIS );
        }

La ventana se redimensionó correctamente, y la barra de estado no volvió a aparecer independientemente del evento que desencadenó esto.

 1
Author: BuvinJ,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-06-17 18:59:50

Mostrar Inmersión completa:

private void askForFullScreen()
    {
        getActivity().getWindow().getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
                        | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                        | View.SYSTEM_UI_FLAG_IMMERSIVE);
    }

Salir del modo de inmersión completa:

 private void moveOutOfFullScreen() {
        getActivity().getWindow().getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
    }
 1
Author: Gal Rom,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-02-03 12:05:34
 @Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    adjustFullScreen(newConfig);
}

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus) {
        adjustFullScreen(getResources().getConfiguration());
    }
}
private void adjustFullScreen(Configuration config) {
    final View decorView = getWindow().getDecorView();
    if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
        decorView.setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
    } else {
        decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
    }
}
 1
Author: Tarun konda,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-02-05 11:58:27

Aquí hay un código de ejemplo. Puede activar / desactivar banderas para ocultar / mostrar partes específicas.

introduzca la descripción de la imagen aquí

public static void hideSystemUI(Activity activity) {
    View decorView = activity.getWindow().getDecorView();
    decorView.setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    //| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    //| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                    | View.SYSTEM_UI_FLAG_IMMERSIVE);
}

Luego, restablece el estado predeterminado :

introduzca la descripción de la imagen aquí

public static void showSystemUI(Activity activity) {
    View decorView = activity.getWindow().getDecorView();
    decorView.setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}

Puede llamar a las funciones anteriores desde su onCreate:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.course_activity);
    UiUtils.hideSystemUI(this);
}
 1
Author: arsent,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-27 18:03:00

Con kotlin esta es la manera en que lo hice:

class LoginActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_login)
        window.decorView.systemUiVisibility =
                View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
                View.SYSTEM_UI_FLAG_FULLSCREEN

    }
}

Modo Inmersivo

El modo inmersivo está diseñado para aplicaciones en las que el usuario interactuará intensamente con la pantalla. Los ejemplos son juegos, ver imágenes en una galería o leer contenido paginado, como un libro o diapositivas en una presentación. Para esto, simplemente agregue estas líneas:

View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION

Sticky immersive

En el modo de inmersión regular, cada vez que un usuario desliza desde un borde, el sistema se encarga de revelar las barras del sistema: tu aplicación ni siquiera se dará cuenta de que se produjo el gesto. Por lo tanto, si el usuario realmente necesita deslizar desde el borde de la pantalla como parte de la experiencia de la aplicación principal, como cuando juega un juego que requiere mucho deslizar o usar una aplicación de dibujo, debe habilitar el modo inmersivo "pegajoso".

View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY

Para más información: Habilitar el modo de pantalla completa

En caso de que utilice el teclado, a veces sucede que la barra de estado se muestra cuando el teclado aparece. En ese caso, suelo agregar esto a mi estilo xml

Estilos.xml

<style name="FullScreen" parent="AppTheme">
    <item name="android:windowFullscreen">true</item>
</style>

Y también esta línea a mi manifiesto

<activity
        android:name=".ui.login.LoginActivity"
        android:label="@string/title_activity_login"
        android:theme="@style/FullScreen">
 1
Author: Jorge Casariego,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-04-30 18:09:22
 protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_splash_screen);
    getSupportActionBar().hide();

}
 0
Author: saigopi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-03-10 02:36:22

Después de mucho tiempo sin éxito vine con mi propia solución que se deja similar con otro desarrollador. Así que si alguien la necesita is.My el problema era que la barra de navegación del sistema no se ocultaba después de llamar. También en mi caso necesitaba paisaje, así que por si acaso comentar esa línea y todo eso. En primer lugar, crear estilo

    <style name="FullscreenTheme" parent="AppTheme">
    <item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item>
    <item name="android:windowActionBarOverlay">true</item>
    <item name="android:windowBackground">@null</item>
    <item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item>
    <item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
</style>

Este es mi archivo de manifiesto

<activity
        android:name=".Splash"
        android:screenOrientation="landscape"
        android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|screenSize"
        android:label="@string/app_name"
        android:theme="@style/SplashTheme">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity
        android:name=".MainActivity"
        android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|screenSize"
        android:screenOrientation="landscape"
        android:label="@string/app_name"
        android:theme="@style/FullscreenTheme">
    </activity>

Esta es mi actividad spalsh

public class Splash extends Activity {
/** Duration of wait **/
private final int SPLASH_DISPLAY_LENGTH = 2000;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.splash_creen);

    /* New Handler to start the Menu-Activity
     * and close this Splash-Screen after some seconds.*/
    new Handler().postDelayed(new Runnable(){
        @Override
        public void run() {
            /* Create an Intent that will start the Menu-Activity. */
            Intent mainIntent = new Intent(Splash.this,MainActivity.class);
            Splash.this.startActivity(mainIntent);
            Splash.this.finish();
        }
    }, SPLASH_DISPLAY_LENGTH);
}

}

Y esta es mi actividad principal a pantalla completa. angeystemuivisibilitychange este método es salir importante de lo contrario barra de navegación principal de Android después de llamar se quedará y no desaparecerá más. Problema muy irritante, pero esta función resuelve ese problema.

Public class MainActivity extiende AppCompatActivity {

private View mContentView;
@Override
public void onResume(){
    super.onResume();

    mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

}
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.fullscreen2);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null)
    {
        actionBar.hide();
    }
    mContentView = findViewById(R.id.fullscreen_content_text);
    mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);



    View decorView = getWindow().getDecorView();
    decorView.setOnSystemUiVisibilityChangeListener
            (new View.OnSystemUiVisibilityChangeListener()
            {
                @Override
                public void onSystemUiVisibilityChange(int visibility)
                {
                    System.out.println("print");

                    if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0)
                    {
                        mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
                                | View.SYSTEM_UI_FLAG_FULLSCREEN
                                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                                | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
                    }
                    else
                    {

                        mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
                                    | View.SYSTEM_UI_FLAG_FULLSCREEN
                                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

                        }
                }
            });

}

}

Este es mi diseño de pantalla de bienvenida:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <ImageView android:id="@+id/splashscreen" android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:background="@android:color/white"
        android:src="@drawable/splash"
        android:layout_gravity="center"/>
    <TextView android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Hello World, splash"/>
</LinearLayout>

This is my fullscreen layout
    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#0099cc"
        >
        <TextView
            android:id="@+id/fullscreen_content_text"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:keepScreenOn="true"
            android:text="@string/dummy_content2"
            android:textColor="#33b5e5"
            android:textSize="50sp"
            android:textStyle="bold" />

    </FrameLayout>

Espero que esto te ayude

 0
Author: Jevgenij Kononov,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-08-15 13:55:06

Https://developer.android.com/training/system-ui/immersive.html

Actividad:

@Override
public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
    if (hasFocus) {
        decorView.setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_FULLSCREEN
                | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
    }
}

AndroidManifests:

 <activity android:name=".LoginActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:label="@string/title_activity_login"
            android:theme="@style/FullscreenTheme"
            ></activity>
 0
Author: Dheerendra Mitm,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-08-29 13:49:22

Dentro de los estilos .xml ...

<!-- No action bar -->
<style name="NoActonBar" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Theme customization. -->
    <item name="colorPrimary">#000</item>
    <item name="colorPrimaryDark">#444</item>
    <item name="colorAccent">#999</item>
    <item name="android:windowFullscreen">true</item>
</style>

Esto funcionó para mí. Espero que te ayude.

 0
Author: Anuj Sain,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-02-10 18:53:11

Simplemente pegue este código en onCreate() método

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
 0
Author: Ahsan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-09-01 10:19:39

Funcionó para mí.

if (Build.VERSION.SDK_INT < 16) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else {
        View decorView = getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOptions);
    }
 -1
Author: Singh,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-07-18 15:53:20
getWindow().addFlags(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
 -4
Author: Shyam,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-11-25 10:16:48