Search code examples
androidresolutionpixel

Android Screen Resolutions px and dp


For icons they are: 36x36px 48x48px 72x72px 96x96px

And for screen sizes they are: 426x320 470x320 640x480 960x720

But I think I might have heard from the website that those screen sizes are in dp. I know that "dp" is dimmensional pixels. But my question is: When I go into Adobe Illustrator to create a background for the small screen size (426x320), should I use the unit PIXELS or do I need to convert those numbers to something else.


Solution

  • dp is not "dimmensional pixels" . it's "(density) independent pixels" (see here and here) . they are based on the density of the device , not the resolution .

    for example , for application icons , it's always 48 dp , since on mdpi(160 dpi) , 48 dp== 48 pixels . therefore , on hdpi (240 dpi) , it's 48*1.5=72 pixels , on ldpi(120 dpi) it's 48*0.75=36 , and on xhdpi (320 dpi) it's 48*2=96 pixels .

    if you wish to have the best results of showing images, create the images based on the dpi level of your target devices. this means that for each dpi level , you need to create an image best suited for it , and put it on the correct folder in the "res" folder .

    this could take x4 times , and you might simply prefer having a single file instead . it all depends on the result that you see. if you can't tell the difference of your image on an mdpi device and xhdpi device , you don't have to make any changes.

    for more information on android graphical design , read this: http://developer.android.com/design/index.html