Flutter项目中设置安卓启动页

embedded/2025/2/23 3:21:51/

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

<applicationandroid:label="@string/app_name"android:name="${applicationName}"android:icon="@mipmap/ic_launcher"android:roundIcon="@mipmap/ic_launcher"android:theme="@style/LaunchTheme"><activityandroid: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 asthe Android process has started. This theme is visible to the userwhile the Flutter UI initializes. After that, this theme continuesto determine the Window background behind the Flutter UI. --><meta-dataandroid: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-dataandroid: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><itemandroid:width="65dp"android:height="326dp"android:gravity="center_horizontal|clip_vertical"android:top="145dp"><bitmap android:src="@drawable/ver6_bg_word" /></item><itemandroid: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.ppmy.cn/embedded/164519.html

相关文章

毕业项目推荐:基于yolov8/yolo11的水稻叶片病害检测识别系统(python+卷积神经网络)

文章目录 概要一、整体资源介绍技术要点功能展示&#xff1a;功能1 支持单张图片识别功能2 支持遍历文件夹识别功能3 支持识别视频文件功能4 支持摄像头识别功能5 支持结果文件导出&#xff08;xls格式&#xff09;功能6 支持切换检测到的目标查看 二、数据集三、算法介绍1. YO…

详解分布式ID实践

引言 分布式ID&#xff0c;所谓的分布式ID&#xff0c;就是针对整个系统而言&#xff0c;任何时刻获取一个ID&#xff0c;无论系统处于何种情况&#xff0c;该值不会与之前产生的值重复&#xff0c;之后获取分布式ID时&#xff0c;也不会再获取到与其相同的值&#xff0c;它是…

计算机网络基础杂谈(局域网、ip、子网掩码、网关、DNS)

目录 1. 简单局域网的构成 2. IP 地址 3. 子网掩码 4. IP地址详解自定义IP 5. IP 地址详解 6. 网关 7. DNS 域名解析 8. ping 1. 简单局域网的构成 交换机是组建局域网最重要的设备&#xff0c;换句话说&#xff0c;没有交换机就没法搭建局域网 交换机不能让局域网连…

股指期货合约交易时怎么选择合约?股指期货连续合约是什么?

先选对标的指数&#xff0c;再选活跃的主力合约&#xff0c;近月合约最常用。 股指期货合约交易时怎么选择合约&#xff1f; 首先&#xff0c;先确定标的的指数 我国的股指期货标的一共有四个&#xff0c;分别是沪深300股指期货、上证50股指期货、中证500股指期货以及中证100…

3D模型在线转换工具:轻松实现3DM转OBJ

3D模型在线转换是一款功能强大的在线工具&#xff0c;支持多种3D模型格式的在线预览和互转。无论是工业设计、建筑设计&#xff0c;还是数字艺术领域&#xff0c;这款工具都能满足您的需求。 3DM与OBJ格式简介 3DM格式&#xff1a;3DM是一种广泛应用于三维建模的文件格式&…

Ubuntu 下 nginx-1.24.0 源码分析 - ngx_os_specific_init函数

ngx_os_specific_init 声明在 src/os/unix/ngx_os.h ngx_int_t ngx_os_specific_init(ngx_log_t *log); 定义在 src\os\unix\ngx_linux_init.c ngx_int_t ngx_os_specific_init(ngx_log_t *log) {struct utsname u;if (uname(&u) -1) {ngx_log_error(NGX_LOG_ALERT, log,…

Python爬虫实战:从零到一构建数据采集系统

文章目录 前言一、准备工作1.1 环境配置1.2 选择目标网站 二、爬虫实现步骤2.1 获取网页内容2.2 解析HTML2.3 数据保存 三、完整代码示例四、优化与扩展4.1 反爬应对策略4.2 动态页面处理4.3 数据可视化扩展 五、注意事项六、总结互动环节 前言 在大数据时代&#xff0c;数据采…

rust笔记8-Deref与隐式解引用强制转换

Rust 的智能指针和 Deref Trait 是 Rust 中非常重要的概念,它们使得 Rust 的引用和指针操作更加灵活和安全。下面我们将深入介绍 Deref Trait、Deref 与 &、* 运算符的关系,以及 Rust 的隐式解引用强制转换(Deref Coercion)。 1. 智能指针与 Deref Trait 智能指针(如…