当前位置: 首页 > news >正文

Flutter项目中设置安卓启动页

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.dtcms.com/a/30092.html

相关文章:

  • 使用S32DS部署Tensorflow lite到S32K3
  • 【Blender】二、建模篇--05,阵列修改器与晶格形变
  • 力扣27. 移除元素(快慢指针)
  • JUC并发—9.并发安全集合三
  • SPRING10_SPRING的生命周期流程图
  • 使用Docker Desktop部署GitLab
  • vue语法---样式操作-行内样式
  • AI IDE 新势力 Trae 功能深度解析:Builder与Chat模式的应用场景与市场竞争力分析
  • 天 锐 蓝盾终端安全管理系统:办公U盘拷贝使用管控限制
  • Spring容器初始化扩展点:ApplicationContextInitializer
  • 简单模拟实现一个线程池
  • Redis数据结构-String字符串
  • Unity 中导入的VRM模型渲染为VRoid风格
  • python学智能算法|模拟退火算法
  • ptython setup.py install 设置python包编译时的并行数
  • eNSP下载安装(eNsp、WinPcap、Wireshark、VirtualBox下载安装)
  • 【接口测试】使用Requests库发送POST请求
  • 1分钟快速了解——Java几种常见的锁
  • Django Admin: 实现基于数据库实际值的动态过滤器
  • Unity游戏制作中的C#基础(6)方法和类的知识点深度剖析
  • 前端如何转战鸿蒙
  • 通过LM Studio本地私有化部署DeepSeek-R1模型,无网络也能用
  • 【Java】集成easyexcel
  • 最新版IDEA下载安装教程
  • LangChain-基础(prompts、序列化、流式输出、自定义输出)
  • ESP32 websocket-client
  • 创建一个简单的spring boot+vue前后端分离项目
  • LangChain大模型应用开发:自定义工具调用
  • 基于 Highcharts 实现 Vue 中的答题统计柱状图组件
  • vue3 采用xlsx库实现本地上传excel文件,前端解析为Json数据