简体   繁体   中英

Galaxy S10, S10+ Full Screen Mode

How can achieve full screen mode with Samsung Galaxy S10 and S10+, the following code do not work for me:

getWindow().getDecorView().setSystemUiVisibility(
// Set the content to appear under the system bars so that the
// content doesn't resize when the system bars hide and show.
SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
// Hide the nav bar and status bar
// | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);

It hide the content of the status bar but it doesn't hide the status bar it self :(

Please help

Put in the style of your app the following fixed this issue for me:

<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>

For more details about supporting cutout look at this:

https://developer.android.com/guide/topics/display-cutout

Try to create a style:

<style 
    name="Theme.AppCompat.Light.NoActionBar.FullScreen" 
    parent="@style/Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

and then apply the theme to your activity:

<activity
   android:name=".MyActivity"
   android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen" 
/>

UPDATE:

AFAIK, Samsung S10 has an aspect ratio of 19:9 (equivalent to 2.1) So, in your manifest, add this tag on your <application>

<meta-data android:name="android.max_aspect" android:value="2.1" />

You can also try to set the resizeableActivity for Activity or Application:

android:resizeableActivity="true"

From docs linked by Mohamad Bdour:

Note that Android might not allow the content view to overlap the system bars. To override this behavior and force content to extend into the cutout area, apply any of the following flags to the view visibility via the View.setSystemUiVisibility(int) method:

SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION SYSTEM_UI_FLAG_LAYOUT_STABLE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM