سؤال

I want to set a splash for my android application and I wonder that which resolution of picture belongs to which category of drawable folder in bundleSDK (hdpi, xhdpi, xxhdpi etc) ?

هل كانت مفيدة؟

المحلول

Here are the details:

36x36 for low-density (LDPI - 120dpi)

48x48 for medium-density (MDPI - 160dpi)

72x72 for high-density (HDPI - 320dpi)

96x96 for extra high-density (XHDPI)

144x144 for extra extra high-density (XXHDPI)

Google's guide - http://developer.android.com/guide/practices/screens_support.html

Source - Android screen size HDPI, LDPI, MDPI

نصائح أخرى

As described here bitmaps for different screen dencity values have following ratios: ldpi:mdpi:hdpi:xhdpi - 3:4:6:8. I'd recommend you to use either some composite layout or layer-drawable

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

    <item>
        <!-- background goes here -->
        <shape android:shape="rectangle" >
            <solid android:color="#000" />
        </shape>
    </item>
    <item>
        <!-- splash-screen image -->
        <bitmap
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:dither="true"
            android:gravity="center"
            android:src="@drawable/your_bitmap"
            android:tileMode="disabled" >
        </bitmap>
    </item>

</layer-list>

your_bitmap stands for your splash screen art that exists in different resolutions, according to screen densities.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top