Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is possible to set width for icon in Android 12 Splash screens API

I want to display app icon (120dpx120dp) in SplashScreen. I am using Splash screens but it display bigger than 120dp. For any vector, it always bigger than 120dp.
After screenshot and calculate by Paint tool, I see that the app icon size in my device (Pixel 4XL) is ~ 160dp. So, if I add a padding 20dp to my app icon, on my Pixel 4XL device, the app icon will look like 120dpx120dp. But I don't know if it work in other device or not?

like image 842
Linh Avatar asked Sep 13 '21 08:09

Linh


1 Answers

In version 1.0.0-alpha02, splash screen icon size is set to 288dp. If you want to make icon smaller, you can add scale to your vector drawable. Something like this:

<vector
    xmlns:android="http://schemas.android.com/apk/res/android"
    ...
    android:viewportWidth="48"
    android:viewportHeight="48"
    >
    <group
        android:pivotX="24"
        android:pivotY="24"
        android:scaleX="0.25"
        android:scaleY="0.25"
        >
        <path
            ...
            />
        <path
            ...
            />
    </group>
</vector>

This would resize your splash screen icon to 72dp.

like image 138
Marek Avatar answered Sep 17 '22 23:09

Marek