java – What are the default sizes of android images?


I'm creating my first app on the Android platform and as far as I know one of the downsides of this platform is that the devices on the market have different screen sizes.

I created a project in Eclipse and verified that it creates 4 types of folders to add the images, and my question is: How to know what is the size of the images referring to each type of screen? I have an image with the size of 150×100 and it works correctly for the S3 screen, but on other phones with smaller screens it looks quite different. What do I have to do to make everyone agree, regardless of the screen size?

How big are the images for each folder if I have an image for S3 in size 150×100?


It's not that there are standard sizes, after all your image can occupy a small corner of the screen or even a full screen. However, there are recommendations.

The point is: your layout must be resized to the user's screen size. If you use very large images they will look awkward and heavy on small screens. If you use small images they will be jagged on large screens.

In the documentation regarding this, the most recent solution pointed out is to use size ranges for width, height, or both. This is done by naming the directories with a specific pattern. For example:

  • sw600dp : folder will be used on screens where height and width are both greater than or equal to 600 pixels [1] .
  • w720dp : The folder will be used on screens where the width is greater than or equal to 720 pixels [1] .
  • h720dp : the folder will be used on screens where the height is greater than and equal to 720 pixels [1] .

You must configure your app to tell Android which resolutions it supports.

For illustration only, you could create folders with widths of 480 , 600, and 720 pixels [1] with an image to display in full screen. The tracks where it would be:

  • Up to 479 : Android uses the res/layout/ folder
  • From 480 to 599 : Android uses res/layout-w480dp
  • From 600 to 719 : Android uses res/layout-w600dp
  • From 720 onwards: Android uses the res/layout-w720dp

The images should be at least the size of the upper bound of the bands. For example, as the first band is up to 479 pixels [1] , the image must be at least 479 pixels [1] so that it does not need to be enlarged and thus suffer deformation.

* Note [1]: although I used the "pixel" unit in the above text, it was just for the purpose of simplifying the text. The unit is dp ( density-independent pixels ).

Scroll to Top