[英]Problem with the splashscreen after resume ( Flutter - Android )
I've got a problem with my flutter app when I want to resume my app on android.当我想在 android 上恢复我的应用程序时,我的 flutter 应用程序有问题。 So I tested the example flutter app that gets generated, but the problem also exists there.
所以我测试了生成的示例 flutter 应用程序,但问题也存在于那里。 I modified only the launch_background.xml file to change the background color to black and put the launcher icon to the splash screen.
我只修改了 launch_background.xml 文件以将背景颜色更改为黑色并将启动器图标置于初始屏幕上。
The problem is that when I resume the app after I paused it, the splash screen is visible for a short period of time.问题是,当我暂停应用程序后恢复应用程序时,启动画面会在短时间内可见。 The gif below shows the problem.
下面的 gif 显示了问题。
Does anyone know a solution for this or do I have to deal with that?有没有人知道这个解决方案,或者我必须处理那个?
Thanks in advance提前致谢
--EDIT-- Changes to the styles.xml in Android --EDIT--Android 中对styles.xml 的更改
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>
Try using flutter_native_splash .尝试使用flutter_native_splash 。 I use it in my all projects and it works flawlessly.
我在我的所有项目中都使用它,它完美无缺。 Their doc says :
他们的医生说:
Automatically generates native code for adding splash screens in Android and iOS.
自动生成用于在 Android 和 iOS 中添加启动画面的本机代码。 Customize with specific platform, background color and splash image.
使用特定平台、背景颜色和初始图像进行自定义。
Make sure to run the package with below line after you make all the changes :进行所有更改后,请确保使用以下行运行包:
flutter pub pub run flutter_native_splash:create
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.