Search code examples
androidxmlimageandroid-layoutscreen-resolution

Splash Image size


I am using theme instead of layout to show splash screen,but I am confused what resolution images to set for different screen densities,because <item> tag's width and height attributes available API>22.

Background drawable

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

    <item android:drawable="@color/colorAccent" />
    <item >
        <bitmap
            android:gravity="center"
            android:src="@drawable/splash_logo" />
    </item>

</layer-list>

Style

  <style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
        <item name="android:windowBackground">@drawable/splash_background</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorPrimary">@color/colorPrimary</item>
    </style>

Solution

  • Splash Image size for different resolution devices for portrait

    MDPI = 320x480px 
    
    LDPI = 240x360px
    
    HDPI = 480x720px
    
    XHDPI = 640x960px
    
    XXHDPI = 960x1440px
    
    XXXHDPI = 1280x1920px
    

    From https://romannurik.github.io/AndroidAssetStudio/index.html you can make a 9-patch image for all the resolutions - XHDPI,HDPI,MDPI,LDPI