views:

532

answers:

1

The Android documentation says that best practices are to make two drawable directories - one for HDPI and one for MDPI. It also says that if the MDPI directory doesn't exist and a MDPI device is running the app, it will scale down the HDPI ones so everything looks good.

Is there any reason not to just make one high resolution set of graphics?

One con that I can think of is performance issues and one pro I can think of is only having one set of images for your app.

+4  A: 

Basically, the situation with this could be extrapolated for most of the best practices:

You can do it otherwise, but most often that not, you shouldn't.

It's not that you can't go only with drawable-hdpi, but the addition of drawable-ldpi and drawable-mdpi offers you the ability to customize and fine tune your assets, at the price of bulking up a little your application.

Please, keep in mind that this bulking up won't be so dramatic - if you assume that:

  • the resource size is proportional to the pixel count
  • the differences between assets for different resolutions are proportional to the difference between resolutions

the folder drawable-mdpi will be just 37% of drawable-hdpi and drawable-ldpi will be just 18% of drawable-hdpi

Also suffixes for res folders are especially useful when used together - you can have full control over the application. In some cases, resources are pre-defined for a lot more than high-medium-low density screens, so I would say that you shouldn't worry that much for the additional bulk.

As you've thought out, you can avoid the dynamic scaling of the resources (worse than scaling beforehand). It won't be that much of a problem, but most of the time, if you can avoid operations on the device by doing additional preparations in the development/production process, that's a good thing.

Dimitar Dimitrov
Yes, there's no reason not to prepare most of your assets for all sizes. Also note that some assets like the app icon *will* definitely look bad (blurry) when scaled from hdpi down to mdpi or ldpi screens.
Christopher
Thanks, I didn't even consider the fact that the resource sizes are much smaller at lower densities. I want my app to look exactly the same on all devices (for now), so I think only using drawable-hdpi is ok for me as long as I don't see too much degradation in performance.
Brandon
@Christopher - I'll keep that in mind for the app icon. I guess I'll just have to test for in-app graphics.
Brandon
For the app icon I use the hdpi, mdpi and ldpi folders but for most other images I just use the drawable folder containing the high resolution image and scale it appropriately the first time I load an image and then cache it so I can the scaled version again later without having to scale it again.
CaseyB