2

I need my application to support hdpi devices. From what I've read, I need to use 72x72 size for icons, and 640x480 for images. My questions are:

  1. If my android device is mdpi for example, will is scale the images and the icons by itself ? I've read that it has a fair view after scaling.

  2. Where should I place all my resources ? only in drawbles\hdpi folder ? or only in drawbles folder?

ohadinho
  • 6,894
  • 16
  • 71
  • 124

2 Answers2

0

For #1, yes, it will scale them, but in my opinion you should always provide scaled resources of your own. This way you have control over how they look when downscaled (this makes more of a difference the smaller and more detailed they are). Also, 640x480 is by no means a standard size. It depends on what type of image you're wanting, and how large it needs to be. What's important is to understand the ratio between densities.

For #2, you should always have fallback graphics in the res/drawable folder, as Android will not upscale density specific graphics. (e.g. if you're running on an xhdpi Galaxy Nexus, your application will crash)

Community
  • 1
  • 1
Kevin Coppock
  • 133,643
  • 45
  • 263
  • 274
  • so for instance, if I need an image for my splash screen (an image that will cover all the screen view), what size should I use for ldpi,mdpi and hdpi ? – ohadinho Aug 20 '12 at 14:50
  • There's no one answer for that, as resolutions vary widely even for similar densities. The best way is to look into doing your background as a 9-patch if possible (look at the Facebook app's splash screen -- I'm fairly certain it's just a 9-patch with the logo at the center). Otherwise, I would err on the side of a larger image and let Android downscale it, rather than upscaling it. – Kevin Coppock Aug 20 '12 at 14:54
  • so if i'll use images for xhdpi: 960x720 size - Android will downscale them and i'll get fair results ? – ohadinho Aug 20 '12 at 14:59
  • 1
    Assuming the device you're running on is at a lower resolution than 960x720, yes. Also, keep in mind different devices have different aspect ratios, so when you scale it to fit the screen (maintaining proportion) you may end up with some of the image cut off on the sides, so plan for that by keeping important information away from the edges. – Kevin Coppock Aug 20 '12 at 15:01
0

Have a look at the android developer docs regarding supporting multiple screens here: http://developer.android.com/guide/practices/screens_support.html

In short, it is good practice to scale all your images to support multiple screen sizes and densities and put them in the respective folders like:

  • res/drawable-mdpi/my_icon.png // bitmap for medium density
  • res/drawable-hdpi/my_icon.png // bitmap for high density
  • res/drawable-xhdpi/my_icon.png // bitmap for extra high density

and leave it to the Android OS to select the correct image depending on the client device

zeiger
  • 700
  • 5
  • 16