[英]Change Splash Screen Color Programmatically in Flutter
launch_background.xml launch_background.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/orange" />
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="@drawable/splash_icon" />
</item> -->
</layer-list>
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>
<color name="orange">#FF9800</color>
</resources>
I change the primary color value in the app dynamically and set theme colors for app.我动态更改应用程序中的主颜色值并为应用程序设置主题颜色。 How can I send the primary color value here -->
<color name="orange">#FF9800</color>
我如何在这里发送原色值 -->
<color name="orange">#FF9800</color>
Also what should I do for IOS?另外我应该为IOS做什么?
据我所知,您不能以编程方式更改 XML 文件的值。
You can change the color of your splash screen, just follow steps :您可以更改启动画面的颜色,只需按照以下步骤操作:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.