Reputation: 2904
I want to use new Android 12 API for Splash Screen, but if I use my drawable
icon inside theme for parameter windowSplashScreenAnimatedIcon
, its stretched. How can I adjust size of that icon?
My icon is not vector. I have to use png file.
Upvotes: 10
Views: 21981
Reputation: 1
create 2 values directory
in values-v31
<style name="SplashScreenTheme" parent="Theme.SplashScreen">
<item name="android:windowSplashScreenBackground">@color/color_121326
</item>
<item name="postSplashScreenTheme">@style/SplashScreen</item>
<item name="android:windowSplashScreenAnimatedIcon">
@drawable/ic_splash_center
</item>
<item name="splashScreenIconSize">@dimen/dp_100</item>
</style>
and in values-v33
<style name="SplashScreenTheme" parent="Theme.SplashScreen">
<item name="android:windowSplashScreenBackground">@color/color_121326
</item>
<item name="postSplashScreenTheme">@style/SplashScreen</item>
<item name="android:windowSplashScreenAnimatedIcon">
@drawable/drawable_splash
</item>
<item name="splashScreenIconSize">@dimen/dp_100</item>
</style>
in drawable_splash
<item
android:width="@dimen/dp_100"
android:height="@dimen/dp_100"
android:gravity="center">
<bitmap android:src="@drawable/ic_splash_center" />
</item>
i find it works to resize icon above api33
Upvotes: -1
Reputation: 1714
Likely, you have to follow the Splash Screen dimensions. Google says:
Upvotes: 10