MDP
MDP

Reputation: 4267

Can i provide just one drawable folder instead of 4 (hdpi,ldpi,mdpi,xhpi)

What happen if i provide just one drawable folder? Have I to provide 4 different kind of images because otherwise my app will crash?

I know that there are different folders for differets screens. If I provide a low resolution image for a high resolution screen, what will happen? Just a bad image on the screen?

Upvotes: 0

Views: 942

Answers (3)

Siddharth Lele
Siddharth Lele

Reputation: 27748

If the images in question are all 9-patch images, they will scale up / down just fine. If they are not, they will look good on bad depending on which folder you have the drawables in and which the device the app is currently running on.

For example, if you put all the drawables in the drawable-mdpi folder and use the application on a supported device, they might look good. The moment dpi changes to a higher to an hdpi or xhdpi device, they will almost always look bad (pixelated).

Depending on what kind of images you are dealing with, try and use as many 9-patch images as you can use and wherever you can use.

That being said, you have the drawable variants for a reason. And I am not sure if it is a good practice using just identifier especially considering that most developers are also building for tablets these days.

Too each his own I suppose....

Read more about NinePatch and Draw 9-patch tool.

Upvotes: 1

Veger
Veger

Reputation: 37905

Nothing serious will happen if you put all your drawable in the res/drawable folder. But, as you already mentioned depending on the resolution of the device screen the result might be either nice or horrible (or something in between).

So, while you are still writing your application, this is a suitable option (to save you some time), but when you release the application to the public (and allow it to run on multiple device types) you really should provide drawable for all kinds of (supported) resolutions!

Upvotes: 2

Marcelo
Marcelo

Reputation: 2095

You can do this by just naming your folder by "drawable". But I don't recommend this because:

  1. You can't extend you app latter, by adding new images as you have different devices;
  2. You'll must take care of redimensions and image tratments;
  3. You'll must take care with low resolutions resulted from lower dpi's.

Upvotes: 1

Related Questions