4

I've been reading the following: http://developer.android.com/guide/practices/screens_support.html

It's about the folders res-long-land-hdpi, res-notlong-land-dpi, res-notlong-port-ldpi etc. And what they actually mean and when they should be used.

The article also says the following:

  • xlarge screens are at least 960dp x 720dp
  • large screens are at least 640dp x 480dp

I'm developing for a device that is: 1280 x 720 and one that is 480 x 800

My app will only be available in portrait mode.

So that means i have to put images in the res-long-port-hdpi folder for the first device, and in res-notlong-port-ldpi for the second device right?

Then the next problem i have with this is. I have an image which is 332 x 226 pixels. This looks fine on the first (xlarge) device. But to what size do i have to rescale this image so that i can place it in the (lower resolution) res-xx-xx-ldpi folder?

I'm not sure how to calculate the new sizes for the different folders.

1 Answer 1

8

The size ratios should match the nominal pixel densities as Android defines them:

ldpi - 120 pixels/inch; dpi scale = .75 (4 dpi = 3 pixels)
mdpi - 160 pixels/inch; dpi scale = 1 (1 dpi = 1 pixel)
hdpi - 240 pixels/inch; dpi scale = 1.5 (2 dpi = 3 pixels)
xhdpi - 320 pixels/inch; dpi scale = 2 (1 dpi = 2 pixels)

So if you make your xhdpi images twice the size (in pixels) of the mdpi resources, they will be the same dpi, meaning they will be the same physical size on their respective screens.

Sign up to request clarification or add additional context in comments.

2 Comments

So does this mean that if i use an image for an xhdpi screen 400 x 300 (is the image size) then the size for an mdpi should be 200 x 150. And for an hdpi it's 300 x 225. Is that what you're saying?
@w00 - Exactly (assuming you are measuring image size in pixels). This will result in the image being the same physical size (in inches) on different devices, regardless of pixel density of the devices. (This isn't exact, because device pixel densities don't always exactly match Android's four density categories. For instance, a device with pixel density of 170 pixels/inch will be treated by the system as mdpi. In that case, the images will be slightly smaller in inches than nominal.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.