J'utilise ci-dessous code pour utiliser Immersive mode plein écran:espace blanc lors de l'utilisation Immersive mode plein écran dans Android
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);
Mais quand je lance mon application, un espace blanc montre au lieu de notification et barre inférieure . Je pense que j'ai une erreur dans mon fichier XML. Voici mon fichier XML:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#303030"
tools:context="programsimple.game.FullscreenActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#eeeeee">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"/>
<Button
android:layout_width="110dp"
android:layout_height="70dp"
android:background="@drawable/button_shape"
android:layout_centerVertical="true"
android:id="@+id/btnStartGame"
android:layout_centerHorizontal="true"
android:text="شروع"
android:textSize="25sp"
android:textColor="#97d2ff"/>
</RelativeLayout>
</FrameLayout>
-t-il une erreur?
mise à jour: Je teste avec KitKat.
Je pense que c'est android: fitsSystemWindows = "true", voir les s dans les fits. –
@RakeshYadav Merci pour la correction, n'a pas remarqué que! – Abhi