3

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.

43.52.4D.
  • 950
  • 6
  • 14
  • 28
  • what do you call a "background for small screen size". A picture to put in background? Or a drawable resource (which then should be better a 9-patch) – EricLarch May 12 '12 at 17:54

1 Answers1

11

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

android developer
  • 114,585
  • 152
  • 739
  • 1,270
  • What are Nine-Patch Drawables? – 43.52.4D. May 13 '12 at 13:57
  • they are images that you can choose which part of them (horizontal and vertical ) can be multiplied and which should retain their look. you can also choose what part of them is used for the content itself (for the text) . for more info : http://radleymarx.com/blog/simple-guide-to-9-patch/ . you have a tool that comes with the sdk manager to create such images , which is called "draw9patch" . – android developer May 13 '12 at 14:50
  • @androiddeveloper I have a question about this, if you don't mind. If a manufacturer say the screen resolution is `1,280×768`, how can I then convert this to `dp`? I want my application to support the minimum width of `768px`, the same as the Nexus 4, but I need to provide it in `dp`. – ClassA Sep 24 '18 at 07:18
  • 1
    @ClassA Maybe this could help: https://stackoverflow.com/a/9563438/878126 – android developer Sep 24 '18 at 07:25
  • 1
    "it's "(density) dependent pixels" " - No, the unit is called density-independent pixels (see: https://developer.android.com/guide/topics/resources/more-resources.html#Dimension). – SOUser May 01 '19 at 07:35
  • @SOUser Correct. Was a typo. Even written about it on Wikipedia. I've updated my answer now. Thank you. Have +1 for this. – android developer May 02 '19 at 07:55