Image Assets Guideline : Supporting different screen sizes android

Balwinder Singh Rajput
2 min readOct 2, 2019

As you know android tablets/phones comes in variety of shapes and screen densities and accordingly we need to handle image resolutions so as to support all densities and resolution(tablet only in our case for this project).

Having said that, its recommended to create images as per below guidelines.

Android devices have below set of densities :

· Ldpi

· Mdpi

· Hdpi

· Xhdpi

· Xxhdpi

· xxxhdpi

mdpi is the reference density — that is, 1 px on an mdpi display is equal to 1 dip/dp. The ratio for asset scaling is: ldpi | mdpi | hdpi | xhdpi | xxhdpi | xxxhdpi

0.75 | 1 | 1.5 | 2 | 3 | 4

What this means is if you’re doing a 48dip image and plan to support up to xxhdpi resolution, you should start with a 48px image(mdpi) and make the following images for the densities:

ldpi | mdpi | hdpi | xhdpi | xxhdpi | xxxhdpi

36 x 36 | 48 x 48 | 72 x 72 | 96 x 96 | 144 x 144 | 192 x 192

And these should display at roughly the same size on any device, provided developers placed these in density-specific folders (e.g. drawable-xhdpi, drawable-hdpi, etc.)

For instance, background image for tablet (10 inch) with resolution 1280 * 800 should have following dimension :

Mdpi : 1280 * 800 px

hdpi : mdpi resoltion *1.5 = 1920 * 1200 px

xhdpi : mdpi *2

xxhdpi : mdpi*3

xxxhdpi : mdpi*4

Available tools :

Also, you don’t have to create image for all the above densities every time. All you need is create a xxxhdpi image and upload the same to

http://nsimage.brosteins.com/ For 9 Patch : tps://romannurik.github.io/AndroidAssetStudio/nine-patches.html#&sourceDensity=640&name=example

This will generate the required densities images.

For android device screen size(s) you can always refer http://screensiz.es/

References:

You can further read more about this at https://developer.android.com/guide/practices/screens_support

Please let me know in case you have any queries and suggestion

--

--

Balwinder Singh Rajput

Hi there 👋 Namaste 🙏🏻 .👨‍💻 developing apps from 12+ years. 👨‍🏫 IoT | E-commerce | baking domain expert.