Resources in android pixel density, xxdpi, xdpi, hdpi, mdpi, ldpi


I find that static images included in the apps, with aspect ratio 16: 9 on tablets, brushstrokes are displayed, which is the way to generate resources appropriately for each pixel density ldpi,mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi

I understand that the normal resolution that is normally seen in a PC monitor is the mdpi and I scale the image depending on the base 1024x576 with the following calculator

with the following result:

ldpi    = 768.00px
mdpi    = 1024.00px
tvdpi   = 1363.20px
hdpi    = 1536.00px
xhdpi   = 2048.00px
xxhdpi  = 3072.00px
xxxhdpi = 4096.00px

The source image has more than 5000px , let's say I decrease it to 4096px to create the xxhdpi, then to 3072px for the xxhdpi ...

But still on a tablet Asus TF101 your specifications is displayed pixelated.

Apart from that, I have more questions:

  • Android studio only has a generator for icons and vectors. What tools do you use to automatically render the images?

    the AndroidAssetStudio page does not work with large images

  • To be more optimal with the final size of the apk, if you only put the corresponding image in drawable/xxxhdpi is it necessary to put it in all the others or does Android re-dimension it automatically?

asked by Webserveis 16.09.2016 в 19:57

1 answer


I think I already understand more or less how to do it, the design program that I use fireworks lets me choose the dpi the normal is in 72dpi for PC screen printing.

Reading more about dpi and the constants of DisplayMetrics I see that DENSITY_DEFAULT=160 .

I create a blank image with 160dpi and assign to 1024x756px once created, ren-dimensiono but using modifier dpi I assigned a new value of 640 which is the xxxhdpi and it creates me an image of 4681x2633 here I put the source image.

And for all the others I'm following that table:

Now I see the image without scaled outline.

With the resize-9-patch tool you can create the resources for each screen.

answered by 16.09.2016 / 20:32