Android 星系S10、S10和x2B;全屏模式

Android 星系S10、S10和x2B;全屏模式,android,fullscreen,samsung-mobile,android-fullscreen,samsung-galaxy,Android,Fullscreen,Samsung Mobile,Android Fullscreen,Samsung Galaxy,如何使用三星Galaxy S10和S10+实现全屏模式,以下代码不适用于我: 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.

如何使用三星Galaxy S10和S10+实现全屏模式,以下代码不适用于我:

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
);
它会隐藏状态栏的内容,但不会自行隐藏状态栏:(

请帮助

尝试创建样式:

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

在应用程序的样式中加入以下内容为我解决了此问题:

<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
短边
有关支持剪切的更多详细信息,请参见以下内容:


来自Mohamad Bdour链接的文档:

请注意,Android可能不允许内容视图与 系统栏。覆盖此行为并强制内容扩展 在剪切区域中,对视图应用以下任一标志 通过View.SetSystemMiviability(int)方法的可见性:

系统\用户界面\标志\布局\全屏系统\用户界面\标志\布局\隐藏\导航 系统\用户界面\标志\布局\稳定


好吧,试着在emulator上使用相同的代码,如果它能工作的话,Galaxy s10会有一些特定的东西,因为这个设备将在6月4日发布,我无能为力。如果你在三星工作,建议进行内部研究。实际上s10,s10+已经发布了,我得到了一个。正如问题的标题所说,问题只发生在S10,S10+。我已经编辑了我的答案。你可以尝试另一种方法。纵横比是19:9,是21111111,可能值应该是android:value=“2.2”。只是一个猜测也不起作用,我认为这种行为是三星有意的。请注意,此选项仅适用于API级别27+,因此你需要分离的themes.xml(对于API级别27+您需要res/values-v27/themes.xml)。Android Studio应该建议您在向xml中添加不受支持的属性后,自动执行此重构并为您创建文件。
<meta-data android:name="android.max_aspect" android:value="2.1" />
android:resizeableActivity="true"
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>