Search code examples
androidandroid-layoutandroid-activityandroid-theme

How can I make my Android app full screen?


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


Solution

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