androidpixel-density

How to create proper size drawable on android as it was designed on px image - knowing dimensions,density, etc.?


I would really know how to create proper drawables for android mobile phones. According to lessons from udacity "Android Design for Developers".

Aim: create identical size drawable on screen as it was designed on image. What do I know:

  1. screens size 1440x2560 px

enter image description here

  1. density is 560 dpi - which is xxxhdpi
  2. so, screen in dp dimensions is 411x731 dp
  3. icon is 158x158 px
  4. I know I should put this in xxxhdpi folder.

Should I scale down whole image to dp dimensions (411x731 px) and then design 150x150px "man" to keep the same size in android screen as it was created on image? How could I mange it? So far I use to create "lucky size of image" to get proper size or I was defining custom size in code. But this not the clue. Help.

PS. please do not reffer to supporting screens android page because I were there.


I do not know what px size should have "man" picture for xxxhdpi to get the same size as is on image after taking screenshot.


Solution

  • See. You image dimensions for xxxhdpi is 158x158 px.

    Let's take mdpi as 1x. then, hdpi = 1.5x xhdpi = 2x xxhdpi = 3x xxxhdpi = 4x

    4x = 158x158 (let's add some margin and make it 160x160)
    1x = 40x40
    1.5x = 60x60
    2x = 80x80
    3x = 120x120
    4x = 160x160