问题
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>
Also what should I do for IOS?
回答1:
As far as I know, you can't change values of an XML file programmatically.
来源:https://stackoverflow.com/questions/60115160/change-splash-screen-color-programmatically-in-flutter