Flutter项目中设置安卓启动页

news/2025/2/22 5:46:31

AndroidManifest.xml
设置 android:theme=“@style/LaunchTheme”

<application
        android:label="@string/app_name"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher"
        android:theme="@style/LaunchTheme">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:taskAffinity=""
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>

styles.xml

<?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>
    </style>
    <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>
</resources>

launch_background.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <bitmap android:src="@drawable/launch_image" />
    </item>
    <item
        android:width="65dp"
        android:height="326dp"
        android:gravity="center_horizontal|clip_vertical"
        android:top="145dp">
        <bitmap android:src="@drawable/ver6_bg_word" />
    </item>
    <item
        android:width="209dp"
        android:height="66dp"
        android:bottom="18dp"
        android:gravity="bottom|center_horizontal">
        <bitmap android:src="@drawable/ver6_prod_logo" />
    </item>
</layer-list

项目结构:

在这里插入图片描述

iOS LaunchScreen.storyboard 的使用和适配

修复项目中的警告⚠️
dart fix --apply --code=unused_import
dart fix --apply --code=use_key_in_widget_constructors


http://www.niftyadmin.cn/n/5861678.html

相关文章

阿里云通过docker安装skywalking及elasticsearch操作流程

系统 本文使用系统为 Alibaba Cloud Linux 3.2104 LTS 64位 配置为 4核8G PS&#xff1a;最低配置应为2核4G&#xff0c;配置过低无法启动 安装docker 1.卸载旧版本docker yum remove docker \docker-client \docker-client-latest \docker-common \docker-latest \docker-…

零基础学QT、C++(五)QT编译、导入OpenCV

目录 一、前言 二、准备工作 三、下载OpenCV包 四、包目录 五、版本匹配问题 六、QT导入OpenCV 七、手动编译OpenCV 1、导入项目&#xff08;他会加载很久&#xff0c;耐心等待&#xff09; 2、项目导入完成后&#xff0c;我们就可以开始构建 3、构建完成&#xff0c;就可以看看…

DuodooBMS源码解读之 equipment_work_order模块

Odoo 18 MrpWorkOrder 扩展模块用户使用手册 一、引言 本用户使用手册旨在帮助你了解并使用基于 Odoo 18 原生模块扩展的 MrpWorkOrder 模块。该扩展模块为制造工单管理提供了额外的功能&#xff0c;包括设备作业单关联、生产数量计算、检验合格数量统计等。通过本手册&#…

UI 自动化测试框架介绍

UI 自动化测试框架是用于模拟用户操作、验证界面功能和行为的工具。以下是一些常见的 UI 自动化测试框架,适用于不同的平台和技术栈: 1. Web UI 自动化框架 用于测试 Web 应用程序的 UI 自动化框架: Selenium: Java、Python、C#、JavaScript、Ruby 等。 : 支持多种浏览器(…

11、k8s的hpa和rancher

hpa hpa概念 hpa&#xff1a;自动对pod的数量进行扩缩容。 修改pod的数量&#xff1a; 1、手动——基于控制器——deployment statefulset(副本数) 2、自动扩缩容——基于资源限制的字段&#xff0c;达到阈值之后可以对pod的数量进行自动增加&#xff0c;小于阈值时可以自…

百度搜索,能否将DeepSeek变成“内功”?

最近&#xff0c;所有的云平台和主流APP都在努力接入DeepSeek。其中&#xff0c;搜索类APP与搜索引擎更是“战况激烈”。那么问题来了&#xff0c;接入DeepSeek已经变成了标准配置&#xff0c;到底应该如何做出差异化&#xff1f;接入DeepSeek这件事能不能实现11大于2的效果&am…

Redis复制性能优化利器:深入解析replica-lazy-flush参数

Redis复制性能优化利器&#xff1a;深入解析replica-lazy-flush参数 在Redis的主从复制场景中&#xff0c;你是否遇到过这些情况&#xff1f; 主从全量同步时从节点长时间不可用大数据量同步期间出现连接超时内存使用量在同步期间突然飙升 这些问题的解决方案可能就藏在repl…

Linux 内核网络设备驱动编程:私有协议支持

一、struct net_device的通用性与私有协议的使用 struct net_device是Linux内核中用于描述网络设备的核心数据结构,它不仅限于TCP/IP协议,还可以用于支持各种类型的网络协议,包括私有协议。其原因如下: 协议无关性:struct net_device的设计是通用的,它本身并不依赖于任何…