Am I understanding Android density independence correctly?

40 views Asked by At

Let's say I am testing my app on an xhdpi device, and I have an ImageView set up with size 50dp by 50dp.

Does this mean I need to create the following assets:

dp  Screen density      dpi     px
50  xxxhdpi             640     200
50  xxhdpi              480     150
50  xhdpi               320     100
50  hdpi                240     75
50  mdpi                160     50
50  ldpi                120     37.5

As in, the 50dp remains the same across everything, but I'd be making these various images with the corresponding px widths and heights?

If so: Should I be designing the image at the smallest level and scaling up, or the largest level and scaling down?

1

There are 1 answers

3
Ranjan On

Use Largest level and scaling down, Use this link for reference by google developers.