颤动飞溅_屏幕Android 12

r6hnlfcb  于 2022-09-21  发布在  Android
关注(0)|答案(3)|浏览(208)

当用户打开我的应用程序并颤动加载我的应用程序时,我需要显示闪屏(图像:Backging_Light_SC.png)。我用这个package,一切都很好。但如果我在Android 12中启动我的应用程序,我会在Splash Screen中看到图标应用程序的白色背景。

pubspec.yaml

flutter_native_splash:
 background_image: "assets/images/background_light_SC.png"
 android: true
 android12: true
 ios:  true

怎么了?在安卓12之前的所有安卓系统中,一切都运行得很好。

s5a0g9ez

s5a0g9ez1#

按照此处概述的步骤设置Ffltter_Native_Splash程序包。https://pub.dev/packages/flutter_native_splash

对于Android 12,您需要像上面的用户指定的那样,在fltter_ative_plash.yaml文件中指定以下内容:

android_12:

# The image parameter sets the splash screen icon image.  If this parameter is not specified,

# the app's launcher icon will be used instead.

# Please note that the splash screen will be clipped to a circle on the center of the screen.

# App icon with an icon background: This should be 960×960 pixels, and fit within a circle

# 640 pixels in diameter.

# App icon without an icon background: This should be 1152×1152 pixels, and fit within a circle

# 768 pixels in diameter.

# image: assets/android12splash.png

# Splash screen background color.

# color: "#42a5f5"

# App icon background color.

# icon_background_color: "#111111"

# The image_dark parameter and icon_background_color_dark set the image and icon background

# color when the device is in dark mode. If they are not specified, the app will use the

# parameters from above.

# image_dark: assets/android12splash-invert.png

# color_dark: "#042a49"

# icon_background_color_dark: "#eeeeee"

您只需取消对与您的应用程序相关的字段的注解。例如,您可能只需要设置

image: assets/android12splash.png

完成更改后,请确保在项目的根目录中运行以下命令,以构建闪屏:

flutter clean
flutter pub get
flutter pub run flutter_native_splash:create --path=path/to/your/flutter_native_splash.yaml
vngu2lb8

vngu2lb82#

package中指定的:

Android 12支持

Android 12有一个添加闪屏的new method,它由窗口背景、图标和图标背景组成。请注意,不支持背景图像。

该软件包提供了对Android 12的支持,同时保留了以前版本Android的传统闪屏。

请注意:当您从Android Studio启动应用程序时,可能不会出现闪屏。然而,当你点击Android中的启动图标启动时,它应该会出现。

您还需要编辑以下示例中的pubspec.yaml。我认为加上android12:true是不够的

android_12:
    # The image parameter sets the splash screen icon image.  If this parameter is not specified,
    # the app's launcher icon will be used instead.
    # Please note that the splash screen will be clipped to a circle on the center of the screen.
    # App icon with an icon background: This should be 960×960 pixels, and fit within a circle
    # 640 pixels in diameter.
    # App icon without an icon background: This should be 1152×1152 pixels, and fit within a circle
    # 768 pixels in diameter.
    #image: assets/android12splash.png

    # App icon background color.
    #icon_background_color: "#111111"

    # The image_dark parameter and icon_background_color_dark set the image and icon background
    # color when the device is in dark mode. If they are not specified, the app will use the
    # parameters from above.
    #image_dark: assets/android12splash-invert.png
    #icon_background_color_dark: "#eeeeee"
u0sqgete

u0sqgete3#

如@Dani3le_Answer“注意背景图片不受支持”中所述。这意味着你只能玩启动屏幕图标和背景颜色,而不能玩背景图像…

另一种老式的方法是在启动屏幕显示3秒后显示闪屏…但你最终会看到2个Android 12的闪屏。

相关问题