androidandroid-drawableandroid-resourcesscreen-resolutionandroid-resolution

Screen densities and images dimensions


Hi Android developers,

I want to know how to choose the dimensions of drawables; for example, I have an image that I want to insert in my app, what size (pixel) the image should be to be inserted inside xxhdpi, xhdpi, hdpi, mdpi, and ldpi ?

I've analyzed many android apps on GitHub, they use random image sizes (pixel) for different densities.


Solution

  • To create alternative bitmap drawables for different densities, you should follow the 3:4:6:8:12:16 scaling ratio between the six generalized densities. For example, if you have a bitmap drawable that's 48x48 pixels for medium-density screens, all the different sizes should be:

    • 36x36 (0.75x) for low-density
    • 48x48 (1.0x baseline) for medium-density
    • 72x72 (1.5x) for high-density
    • 96x96 (2.0x) for extra-high-density
    • 144x144 (3.0x) for extra-extra-high-density
    • 192x192 (4.0x) for extra-extra-extra-high-density

    Source: https://developer.android.com/guide/practices/screens_support.html#DesigningResources