The foreground of my mipmap logo shows along with a grey background before my custom made splash screen shows over my webview (the splash screen gets shown from onCreate()
):
I want to change the background color to white, and also, if possible, change the image to instead of the foreground of the app icon, show both the background and foreground so it shows as a complete logo. Is this possible? And if so, how?
Here's some of my code:
AndroidManifest
:
<application
....
android:icon="@mipmap/ic_favicon_1144_round"
....
ic_favicon_1144_round
:
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_favicon_1144_background"/>
<foreground android:drawable="@drawable/ic_logo_48_foreground"/>
</adaptive-icon>
By the way, I haven't done any code to show the foreground or the grey background specifically. If you'd like to see any more code just drop a comment and I'll edit in my question. Any help on this would be really appriecated, even if you can't awnser the entire question! Thank you :)
CodePudding user response:
I suggest you to use the latest splash screen if you are using android 12 and above
you should ad this code in your theme.xml
</style>
<style name="Theme.Starting" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/purple_700</item>
<item
name="windowSplashScreenAnimatedIcon">@drawable/ic_round_local_movies_24</item>
<item name="windowSplashScreenAnimationDuration">1000</item>
<item name="postSplashScreenTheme">@style/Theme.MoviesApp</item>
</style>
you can adjust the icon and background in here
and of course you should add this code to your manifest
file in the activity section
android:theme="@style/Theme.Starting"
and this code in you main activity, after onCreate and before setContent view
val splashScreen = installSplashScreen()