0

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?

  • Possible duplicate of [If I have an image 50dp wide/tall in xhdpi, what size do I make for mdpi?](http://stackoverflow.com/questions/41196119/if-i-have-an-image-50dp-wide-tall-in-xhdpi-what-size-do-i-make-for-mdpi) – Harshad Pansuriya Dec 17 '16 at 08:01
  • all the information is right only you have set `ImageView` size according to device screenSize. – Harshad Pansuriya Dec 17 '16 at 08:02
  • @Ironman What do you mean by that? Are you saying it needs to be set to something else? – user7309495 Dec 17 '16 at 08:09

1 Answers1

0

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

Ranjan
  • 1,326
  • 18
  • 38
  • Where does it say use largest and scale down? – user7309495 Dec 17 '16 at 08:10
  • If you scale down to up, in that approach if any device has higher dpi resolution,the image will not look good, Apart from that,You don't need to worry about actual visual content necessarily. Android will have to use ImageView or other appropriate layout element to placeholder that visual content with defined density width & height, – Ranjan Dec 17 '16 at 09:04
  • Here is a one more link which will help you to choose images in best way. http://www.tivix.com/blog/perfect-resource-image-size-dpi-for-any-android-de/ – Ranjan Dec 17 '16 at 09:06