Can the native android splash screen color be changed programmatically, so that it can be set fitting to the theme chosen for the Flutter app?
Kind of like how the WhatsApp splash screen loads in a dark theme when the System theme is set to dark.
Dark and light WhatsApp splash screen:
I guess this uses two themes for the splash screen, which are linked to the system theme, but I don't know that much about how and if that's possible.
So the question is: Is it possible to change the color/theme of the splash screen while running a flutter application, so that on the next start of the app the native android splash screen loads in the same theme as the Flutter app?
(Sorry if I repeated myself a lot, but I want to describe what I'm asking as good as possible)
Search for and select Open App, and then, on the New Shortcut page, tap Choose. Locate the app whose appearance you want to change. Back on the New Shortcut page, you'll see the app name; tap More (three dots), change the app's name, tap its icon, select Color, and choose a new color.
Step 1: After opening the android studio and creating a new project with an empty activity. Step 2: Navigate to res/values/colors. xml, and add a color that you want to change for the status bar.
In your project folder's android/app/src/main/res
there should be a drawable
folder, which contains the launch_background.xml
for light theme. Duplicate this folder and call the second one drawable-night
and configure the dark theme style. It will automatically change based on Android's system theme.
The launch_background.xml
in the drawable
(light theme) folder can be structured as so, to display an image with a white background:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<item>
<bitmap
android:gravity="center"
android:src="@drawable/launch_image" />
</item>
</layer-list>
The same can be done in the launch_background.xml
in the drawable-night
(dark theme) folder, replacing "@android:color/white"
with "@android:color/black"
for a black background.
Do note that the images must be inside of the drawable
and drawable-night
folders being used respectively. As far as I know, the format must be a png.
I found this useful article that addresses and explains native splash screen theming.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With