Skip to main content

Flutter启动屏配置

Android#

将图片 launch_view.png 分别放入 android/app/src/main/res/ 下的文件夹中:#

  • mipmap-xhdpi
  • mipmap-xxhdpi
  • mipmap-xxxhdpi

编辑 android/app/src/main/res/drawable/launch_background.xml#

<?xml version="1.0" encoding="utf-8"?><!-- Modify this file to customize your launch splash screen --><layer-list xmlns:android="http://schemas.android.com/apk/res/android">    <item android:drawable="@android:color/white" />    <!-- You can insert your own image assets here -->    <!-- <item>        <bitmap android:gravity="center" android:src="@mipmap/launch_image" />    </item> -->    <item>        <bitmap android:gravity="fill" android:mipMap="false" android:src="@mipmap/launch_view"/>    </item>
</layer-list>

bitmap 相关属性#

  • android:antialias 布尔值。启用或停用抗锯齿。
  • android:dither 布尔值。当位图的像素配置与屏幕不同时(例如:ARGB 8888 位图和 RGB 565 屏幕),启用或停用位图抖动。
  • android:filter 布尔值。启用或停用位图过滤。当位图收缩或拉伸以使其外观平滑时使用过滤。
  • android:gravity 定义位图的重力。重力指示当位图小于容器时,可绘制对象在其容器中放置的位置。 必须是以下一个或多个(用 '|' 分隔)常量值:
说明
top将对象放在其容器顶部,不改变其大小。
bottom将对象放在其容器底部,不改变其大小。
left将对象放在其容器左边缘,不改变其大小。
right将对象放在其容器右边缘,不改变其大小。
center图片居中,不改变其大小
center_vertical垂直居中,不改变其大小。
center_horizontal水平居中,不改变其大小。
fill拉伸使其完全适应其容器。这是默认值。
fill_vertical垂直拉伸,使其完全适应其容器。
fill_horizontal水平拉伸,使其完全适应其容器。
clip_vertical上下裁剪。
clip_horizontal左右裁剪
  • android:mipMap 布尔值。启用或停用 mipmap 提示。如需了解详细信息,请参阅 setHasMipMap()。默认值为 false。
  • android:tileMode 定义平铺模式。当平铺模式启用时,位图会重复。重力在平铺模式启用时将被忽略。 必须是以下常量值之一:
说明
disabled不平铺位图。这是默认值。
clamp当着色器绘制范围超出其原边界时复制边缘颜色
repeat水平和垂直重复着色器的图像。
mirror水平和垂直重复着色器的图像,交替镜像图像以使相邻图像始终相接。

注意#

  • 图像尺寸 1080 x 1920