相关疑难解决方法(0)

Android 12 中是否有可能获得未裁剪的启动屏幕?

在早于 Android 12 的 Android 版本上,我可以轻松构建带有未裁剪图像的启动屏幕。例如 Android 11 上是这样的:

Android 11 上的启动屏幕

然而,Android 12 引入了新的启动屏幕 API,我不知道如何在 Android 12 中重现上面的启动屏幕。它似乎总是被裁剪,在 Android 12 上结果如下:

Android 12 上的启动屏幕

这是我android/src/main/res/values/styles.xml的旧 Android 版本(例如 Android 11):

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:windowBackground">@drawable/launch_background</item>
        <item name="android:windowFullscreen">false</item>
    </style>
    <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

这是我android/src/main/res/values-v31/styles.xml的 Android 12:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:windowSplashScreenAnimatedIcon">@drawable/launch_background</item>
        <item name="android:windowFullscreen">false</item>
    </style>
    <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

两者之间的唯一区别styles.xml是我用于android:windowSplashScreenAnimatedIconAndroid 12 和android:windowBackground旧版 Android 版本,如新启动屏幕 …

android-12

5
推荐指数
1
解决办法
3166
查看次数

标签 统计

android-12 ×1