1

I am facing a problem with the size of the generated apk for my app...

I was wondering if there can be any issue if I use only the xxhdpi folder for my drawables... I know that there can be some problem with 9 patch drawable but I don't have any.

The system should take care for scaling down my images, right? Are there other effects that can be dangerous?

Mathias Müller
  • 22,203
  • 13
  • 58
  • 75
aveschini
  • 1,632
  • 3
  • 22
  • 39
  • You should definitly not use only the xxhdpi for your drawable... Take a look at the doc http://developer.android.com/design/style/devices-displays.html – An-droid Apr 03 '14 at 08:21
  • Ok, I read but, it doesn't explain why (or I didn't understand it)... can you please explain why shouldn't I use this technique? – aveschini Apr 03 '14 at 09:51
  • 1
    You must know there are lots of diferent screen sizes with android smartphones. Two solutions : you only use the Drawable folder for all your drawable, be it images, selector, .. OR you use all the folder ldpi, hdpi, xhdpi, xxhdpi, and let android pick the good ones to use with the current phone/tablet. Here i'm only talking about best practices, you can always do what you want ;) (the second choice is the best practice) – An-droid Apr 03 '14 at 09:56

1 Answers1

3
  1. Yes, system takes care for scaling, but scaling at runtime can affect your app's performance, especially when the scaling factor is not power of 2.

  2. Normally scaling down a image wouldn't cause quality problems. however, it may produce a minor impact on image quality under some circumstances, here's a test:

    image in xxhdpi folder, left side is how it looks like on a Nexus 5 (xxhdpi), right side is how it looks like on a Nexus 4 (xhdpi). enter image description here

  3. If image size is less than 4px, app may crash when scaling down.

Conclusion: if app size is more important than problems above, then you can put all images in xxhdpi folder, except the small ones.

bladefury
  • 825
  • 6
  • 16