flutter - 颤动闪屏在物理设备上模糊
问题描述
我的目标是在应用程序初始化时显示启动画面。
所以我使用了这个包:flutter_native_splash: 0.1.9
根据 pub.dev 上的 flutter_native_splash 文档,我根据需要创建了这个文件:
flutter_native_splash:
image: assets/images/splash.png
color: "#ffffff"
fill: true
# android_disable_fullscreen: true
在终端中我运行了这个命令:
flutter pub run flutter_native_splash:create
该软件包为我生成了 drawable-hdpi、drawable-mdpi、drawable-xdpi、drawable-xxdpi、drawable-xxxhdpi 中的图像
现在我可以成功使用这个闪屏,但问题是当我测试时生成的图像在物理设备上非常模糊......
有没有关于如何从一开始就绘制这个图像的指导方针?
它只是一个带有居中文本的简单黑色图像......让我们说例如“启动画面”
我使用 figma 进行绘图,并将文件导出为 SVG。
所以我的问题是:
我应该为我在里面绘制的画布指定宽度和高度吗?!
我应该为文本指定一个固定的字体大小吗...如果是这样...假设有两个文本...居中的一个...以及它下面的副标题。
我多次操纵字体大小,但每次生成的图像都很模糊......
任何帮助将非常感激。
编辑:
这是我绘制图像时来自 figma 的屏幕截图:
解决方案
1.) 制作大小为1080*1920的闪屏背景图片,添加到drawable文件夹(android/app/src/main/res/drawable)。
2.) 将以下代码添加到您的 android 的 styles.xml 中
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@drawable/splash</item>
</style>
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@drawable/splash</item>
</style>
</resources>
3.) 在标签内的 AndroidManifest.xml 中添加以下代码
android:name="io.flutter.app.FlutterApplication"
4.) 在您的第一个活动中添加元数据。
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />
推荐阅读
- html - 在 Django 中通过 POST 消息发送数组
- java - JVM中的日期更改
- android - 无法在 Firebase 数据库的用户 ID 文件夹中创建新路径
- json - 从 ruby 中的 json 数组中的 json 获取值
- jquery - 使用带有 for 循环的 javascript 解析 Json
- image - SVG存储和操作
- python - VS Code Python 测试调试超时
- ios - 在 iOS 13 和 iOS 11.4 中从字符串转换日期的不同结果
- mysql - 这是编写此 MySQL 语句的最有效方法吗?
- git - `go install`-ing私有包时如何输入git repo用户名?