0

This is my style.xml

<resources>
    <style name="AppDefaultTheme" parent="@android:style/Theme.Material.NoActionBar">
        <item name="android:windowTranslucentStatus">true</item>
        <item name="android:windowFullscreen">false</item>
    </style>
</resources>

If I set the fullscreen parameter, the status bar will turn into an ugly black border.

Can I achieve a full screen without the help of appcompat? Or hide the status bar icon?

img1

img2

拉拉姬
  • 140
  • 1
  • 8

2 Answers2

0

In your activity code, you can retrieve the top-level window decor view of the current window and request that the visibility of the status bar or other screen/window decorations be changed.

You can try with multiple flags like this and experiment accordingly.

Example (java):

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
                    | View.SYSTEM_UI_FLAG_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
Rajat Gupta
  • 419
  • 3
  • 10
0

I tried for a long time yesterday to understand the need to add this property.

<item name="android:windowLayoutInDisplayCutoutMode"tools:ignore="NewApi">shortEdges</item>

For applications that do not use appcompat, an immersive status bar should also be added.

<item name="android:windowTranslucentStatus">true</item>
拉拉姬
  • 140
  • 1
  • 8