First you know mdpi = 1, hdpi = 1.5 and xhdpi = 2.
Lets say you have an image in mdpi folder with width = 100px.
On mdpi device the image width will be 100x1 = 100px,
On hdpi device 100x1.5 = 150px,
On xhdpi device 100x2 = 200px.
if you dont have the image in hdpi or xhdpi folders the android system will scale them.
So when you have an Image in hdpi
folder and you run the app on medium density device (mdpi
), the android will scale down the image by 1.5. 233 / 1.5 = 155
.
The same will happend if run the app to hdpi
device you will get an image with ~310 width.
So, to avoid the scaling i suggest to put the image in drawable-nodpi
folder (the images in this folder will not scaled by android system).
PS: if you put the image in drawable
folder and run in mdpi device the image will not scaled because drawable
folder = drawable-mdpi