Hi, I see your worries, a gray flash screen before the splash screen.
The problem is that the default activity that is launched has a gray background color theme.
The solution I am going to show you-you will make changes in two files:
project\platforms\android\app\src\main\AndroidManifest.xml
and
project\platforms\android\app\src\main\res\values\ themes.xml
The path may differ depending on the types of projects and especially the version you are working on.
The themes.xml
file cannot be created by default in this case you have to create it.
First, you have to open the AndroidManifest.xml file and in the Application tag, you see the first activity that looks like this:
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
In the @android: theme
attribute that defaults to
@android:style/Theme.DeviceDefault.NoActionBar
, that’s what we’ll change and put our custom theme. So you can cut this value because we will use it as a parent theme for our custom theme.
Now go to the themes.xml
file and put this.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Blanc" parent="@android:style/Theme.DeviceDefault.NoActionBar">
<item name="android:windowBackground">@android:color/white</item>
</style>
</resources>
The background color value depends on what you want in the item tag, here I choose a white color, if you want to have other android colors go visit here. You cannot use the value like this #fff
.
You guessed it, now you have to go back to our AndroidManifest.xml
and set the value of @android:theme
to : @style/Theme.Blanc
the name of our custom style.
Finally, AndroidManifest
looks like that:
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@style/Theme.Blanc" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I hope to help you.