Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android xdpi folders, what size for my image?

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.

like image 588
w00 Avatar asked Feb 20 '23 15:02

w00


1 Answers

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.

like image 98
Ted Hopp Avatar answered Mar 06 '23 09:03

Ted Hopp