Galaxy S10,S10 +全屏模式

问题描述 投票:0回答:3

如何使用三星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
);

它隐藏状态栏的内容,但它不会隐藏自己的状态栏:(

请帮忙

android fullscreen samsung-mobile android-fullscreen samsung-galaxy
3个回答
4
投票

放入你的应用程序的风格,以下为我解决了这个问题:

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

有关支持切口的更多详细信息,请查看:

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


0
投票

尝试创建一个样式:

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

然后将主题应用于您的活动:

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

更新:

AFAIK,三星S10的宽高比为19:9(相当于2.1)所以,在你的清单中,在你的<application>上添加这个标签

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

您还可以尝试为Activity或Application设置resizeableActivity:

android:resizeableActivity="true"

0
投票

来自Mohamad Bdour联系的文档:

请注意,Android可能不允许内容视图与系统栏重叠。若要覆盖此行为并强制内容扩展到剪切区域,请通过View.setSystemUiVisibility(int)方法将以下任何标志应用于视图可见性:

SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION SYSTEM_UI_FLAG_LAYOUT_STABLE

© www.soinside.com 2019 - 2024. All rights reserved.