Home > Net >  How to change size image of splash by using migrate?
How to change size image of splash by using migrate?

Time:05-18

I I try to make splash screen by using migrate. But I do not change resize image that I used. Here is my picture. What I do:

implementation 'androidx.core:core-splashscreen:1.0.0-beta02'
  • I added this implementation to gradle.
  • I made theme part like this
  • I put this theme in manifest.
  • Finally, I added this in main activity

I hope, someone can solve this problem.

CodePudding user response:

I used a layer-list to resize my app logo:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:width="288dp"
        android:height="288dp"
        android:drawable="@color/splash_screen_background" />

    <item
        android:drawable="@drawable/app_logo"
        android:gravity="center" />

</layer-list>

The library specs can be found here

CodePudding user response:

That image seems too small and possibly should be round with transparent background. In the alpha version, the scaling still worked differently and when upgrading from there, the image didn't fit anymore. Would need to look it up, because one can find the perfectly correct (as expected by the library) dimensions of the splash screen image in the library resources. My code looks like this:

super.onCreate(savedInstanceState);

if (savedInstanceState == null) {
    SplashScreen.installSplashScreen(this);
}

One would commonly use Photoshop or GIMP to change the size of the image (it's predefined). Using a vector drawable XML (similar to SVG) instead of PNG or WEBP scales nicely. And please don't post screenshots of code or errors; to show visual problems that's fine.

  • Related