Pełnoekranowa aktywność w Androidzie?

Jak zrobić aktywność na pełnym ekranie? Bez paska powiadomień. Jakieś pomysły?

Author: Swati Garg, 2010-05-19

25 answers

Możesz to zrobić programowo:

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);
    }
}

Lub możesz to zrobić poprzez plik AndroidManifest.xml:

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

Edit:

Jeśli używasz AppCompatActivity, musisz ustawić motyw jak poniżej

<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/doraprojects.net/template/agent.layouts/content.php on line 54
2018-03-19 09:07:15

Istnieje technika o nazwie Immersive Full-Screen Mode dostępna w KitKat . Wciągające Demo Trybu Pełnoekranowego

Przykład

 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/doraprojects.net/template/agent.layouts/content.php on line 54
2018-04-25 18:19:28

Jeśli nie chcesz używać motywu @android:style/Theme.NoTitleBar.Fullscreen, ponieważ już używasz własnego motywu, możesz użyć android:windowFullscreen.

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

W stylach.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/doraprojects.net/template/agent.layouts/content.php on line 54
2018-07-17 09:39:23

W AndroidManifest.plik 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>  

Lub w Java kod:

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/doraprojects.net/template/agent.layouts/content.php on line 54
2016-02-21 12:26:09

Jeśli używasz AppCompat i ActionBarActivity, użyj tego

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/doraprojects.net/template/agent.layouts/content.php on line 54
2015-01-22 14:50:31

Uważaj na

requestWindowFeature(Window.FEATURE_NO_TITLE);

Jeśli używasz dowolnej metody, aby ustawić pasek akcji w następujący sposób:

getSupportActionBar().setHomeButtonEnabled(true);

Spowoduje wyjątek wskaźnika null.

 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/doraprojects.net/template/agent.layouts/content.php on line 54
2013-09-29 22:12:08

Spróbuj użyć appcompat z style.xml. Może obsługiwać wszystkie platformy.

<!-- 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/doraprojects.net/template/agent.layouts/content.php on line 54
2016-02-01 07:10:47

Korzystanie z Android Studio (obecna wersja to 2.2.2 w tej chwili) jest bardzo łatwe do dodania aktywności na pełnym ekranie.

Zobacz kroki:

  1. Kliknij prawym przyciskiem myszy główny pakiet java > wybierz "nowy" > Wybierz "aktywność" > następnie kliknij "aktywność pełnoekranowa".

Krok pierwszy

  1. Dostosuj aktywność ("Nazwa aktywności", "Nazwa układu" i tak dalej) i kliknij "Zakończ".

Krok drugi

Zrobione!

Teraz masz łatwe wykonywanie aktywności na pełnym ekranie (zobacz klasę java i układ aktywności, aby dowiedzieć się, jak to działa)!

 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/doraprojects.net/template/agent.layouts/content.php on line 54
2016-11-02 20:33:18

Dla osób korzystających z AppCompact... styl.xml

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

Następnie umieścić nazwisko w manifeście...

 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/doraprojects.net/template/agent.layouts/content.php on line 54
2017-09-01 15:53:06

Thanks for answer @ Cristian I was getting error

Android.util.AndroidRuntimeException: requestFeature () musi być wywołane przed dodaniem treści

Rozwiązałem to używając

@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/doraprojects.net/template/agent.layouts/content.php on line 54
2015-11-27 07:11:26

Najpierw musisz ustawić motyw aplikacji z "NoActionBar" jak poniżej

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

Następnie dodaj te linie w aktywności pełnoekranowej.

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);
    }
}

Ukryje Pasek actionbar / toolbar, a także pasek stanu w aktywności pełnoekranowej

 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/doraprojects.net/template/agent.layouts/content.php on line 54
2017-04-18 12:41:54

Chciałem użyć własnego motywu zamiast używać @ android: style / Theme.NoTitleBar.Pełny ekran. Ale to nie działało, jak jakiś post tutaj wspomniał, więc zrobiłem kilka poprawek, aby to rozgryźć.

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

W stylach.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>

Uwaga: w moim przypadku musiałem użyć name="windowActionBar" zamiast name="android:windowActionBar" zanim zadziałało poprawnie. Więc po prostu użyłem obu, aby upewnić się, że w przypadku, gdy muszę później przenieść się do nowej wersji Androida.

 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/doraprojects.net/template/agent.layouts/content.php on line 54
2017-02-22 17:02:01

AndroidManifest.xml

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

I. Twoim głównym motywem aplikacji jest motyw .AppCompat.Światło.DarkActionBar

Dla hide ActionBar / StatusBar
styl.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>

For hide system navigation bar

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. głównym motywem aplikacji jest motyw .AppCompat.Światło.NoActionBar

Dla hide ActionBar / StatusBar
styl.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>

Do ukrycia nawigacji systemu bar

Podobne Jak Theme.AppCompat.Light.DarkActionBar.

Demo
Hope it help

 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/doraprojects.net/template/agent.layouts/content.php on line 54
2018-09-24 09:39:41

Wskazówka: użycie getWindow ().setLayout() może zepsuć wyświetlacz pełnoekranowy! Zwróć uwagę, że dokumentacja tej metody mówi:

Ustawia parametry układu szerokości i wysokości okna... możesz je zmienić ... wartość bezwzględna, aby okno nie było pełnoekranowe.

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

Dla moich celów, odkryłem, że musiałem użyć setLayout z absolute parametry, aby poprawnie zmienić rozmiar mojego okna pełnoekranowego. Przez większość czasu to działało dobrze. Został wywołany przez zdarzenie onConfigurationChanged (). Była jednak czkawka. Jeśli użytkownik opuści aplikację, zmieni orientację i ponownie pojawi się, doprowadzi to do odpalenia mojego kodu, który zawierał setlayout (). Podczas tego okna czasu ponownego wprowadzania, mój pasek stanu (który był ukryty przez manifest) pojawi się ponownie, ale w innym czasie setLayout() nie spowoduje tego! Rozwiązaniem było dodaj dodatkowe wywołanie setLayout () po wywołaniu z twardymi wartościami jak tak:

       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 );
        }

Okno zostało odpowiednio zmienione, a pasek stanu nie pojawił się ponownie niezależnie od zdarzenia, które to wywołało.

 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/doraprojects.net/template/agent.layouts/content.php on line 54
2015-06-17 18:59:50

Pokaż Pełne Zanurzenie:

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);
    }

Wyjście z trybu pełnego zanurzenia:

 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/doraprojects.net/template/agent.layouts/content.php on line 54
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/doraprojects.net/template/agent.layouts/content.php on line 54
2018-02-05 11:58:27

Oto przykładowy kod. Możesz włączyć/wyłączyć flagi, aby ukryć / pokazać określone części.

Tutaj wpisz opis obrazka

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);
}

Następnie resetujesz do domyślnego stanu:

Tutaj wpisz opis obrazka

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);
}

Możesz wywołać powyższe funkcje ze swojego 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/doraprojects.net/template/agent.layouts/content.php on line 54
2018-03-27 18:03:00

Z kotlinem tak zrobiłem:

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

    }
}

Immersive Mode

[5]}Tryb immersive jest przeznaczony dla aplikacji, w których użytkownik będzie silnie oddziaływał na ekran. Przykładami są gry, oglądanie obrazów w galerii lub czytanie stron, takich jak książka lub slajdy w prezentacji. W tym celu wystarczy dodać następujące linie:
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION

Sticky immersive

W zwykłym trybie immersyjnym, za każdym razem, gdy użytkownik przesunie się od krawędzi, system zadba o ujawnienie pasków systemowych-Twoja aplikacja nie będzie nawet świadoma, że gest wystąpił. Jeśli więc użytkownik może rzeczywiście potrzebować przesunięcia palcem od krawędzi ekranu w ramach podstawowej aplikacji-na przykład podczas grania w grę, która wymaga dużego przesuwania lub korzystania z aplikacji do rysowania-powinieneś włączyć tryb "sticky" immersive.

View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY

Aby uzyskać więcej informacji: Włącz tryb pełnoekranowy

W przypadku korzystania z klawiatury, czasami zdarza się, że pasek stanu pokazuje, gdy pojawia się klawiatura. W takim przypadku zwykle dodaję to do mojego stylu xml

Style.xml

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

A także ten wiersz do mojego manifestu

<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/doraprojects.net/template/agent.layouts/content.php on line 54
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/doraprojects.net/template/agent.layouts/content.php on line 54
2017-03-10 02:36:22

Po wielu latach bez powodzenia przyszedłem z własnym rozwiązaniem, które jest quit podobne z innym deweloperem. Więc jeśli ktoś jej potrzebuje is.My problem polegał na tym, że systemowy pasek nawigacyjny nie ukrywał się po wywołaniu. Również w moim przypadku potrzebowałem krajobrazu, więc na wszelki wypadek skomentuj tę linię I to wszystko. Przede wszystkim Utwórz styl

    <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>

To jest mój plik manifest

<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>

To moja aktywność 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);
}

}

I to jest moja główna aktywność pełnoekranowa. onSystemUiVisibilityChange thi metoda jest zamknąć ważne inaczej Android główny pasek nawigacyjny po wywołaniu pozostanie i nie zniknie już. Naprawdę irytujący problem, ale ta funkcja rozwiązuje ten problem.

Klasa Publiczna MainActivity rozszerza 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);

                        }
                }
            });

}

}

To jest mój układ ekranu powitalnego:

<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>

Mam nadzieję, że to ci pomoże

 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/doraprojects.net/template/agent.layouts/content.php on line 54
2017-08-15 13:55:06

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

Aktywność:

@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/doraprojects.net/template/agent.layouts/content.php on line 54
2017-08-29 13:49:22

Wewnątrz Style.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>
To mi pomogło. Mam nadzieję, że ci to pomoże.
 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/doraprojects.net/template/agent.layouts/content.php on line 54
2018-02-10 18:53:11

Po prostu wklej ten kod do metody onCreate()

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/doraprojects.net/template/agent.layouts/content.php on line 54
2018-09-01 10:19:39

U mnie zadziałało.

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/doraprojects.net/template/agent.layouts/content.php on line 54
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/doraprojects.net/template/agent.layouts/content.php on line 54
2016-11-25 10:16:48