问题
I am working with a graphic designer at the moment who is trying to verify what sizes images I am currently using in my app so he can create new images in the right size for all resolution modes (designing the image at the smallest size and then scaling it for the other modes).
In my app, I am emulating a device that is 720 x 1280: xhdpi
, and on this device, an ImageView is set to size 50dp x 50 dp
.
Is it correct to say 50 dp xhdpi -> 25 dp mdpi? 100px? Or 50px?
What exactly? What is the correct size that we should be making for the smallest size?
回答1:
According to Android Documentation
.
From a base image size, there is a 3:4:6:8:12:16
scaling ratio in drawable size by DPI.
LDPI - 0.75x
MDPI - Original size // means 1.0x here
HDPI - 1.5x
XHDPI - 2.0x
XXHDPI - 3x
XXXHDPI - 4.0x
According to the upper difference you can calculate the ImageSize resoultion.
Update :
you have create different size of Image like HDPI
, MDPI
, XHDPI
. but that is not mean that you can set ImageView
Height
and Width
according to it's Drawable
.
Example :
let's some device have small screenSize but it is high density support so you have to set high resolution density Image but the Size of the ImageView
you have create small in that case.
来源:https://stackoverflow.com/questions/41196119/if-i-have-an-image-50dp-wide-tall-in-xhdpi-what-size-do-i-make-for-mdpi