schijndelvanjos
schijndelvanjos

Reputation: 79

Questions regarding drawable folders for Android

Dear StackOverflow users,

I found a of information about what Drawables to use (HDPI, MDPI, LDPI) on StackOverflow. Currently I am using only the HDPI folder. My ImageButtons are 72x72. According to Eclipse, looking at the Graphical Layout of the .XML file, the smallest screen (2.7 IN QVGA) can show all buttons.

If I am correct, Android will scale down the images if someone with MDPI or LDPI screen uses the APP, right? Is there also a setting wherein all different DPI sizes use the 72x72 image? And should I specifically define in the Android Manifest what DPI's are supported? Or when I leave this empty, will it support all possible devices?

Thanks in advance for any answers! (Maybe (parts) of these questions are already answered, but there is so much stuff found by google regarding this)

EDIT:

I found this for my android manifest file. Would this make it work on all devices? And scale down the HDPI images?:

<supports-screens 
android:largeScreens="true" 
android:normalScreens="true" 
android:smallScreens="true"
android:anyDensity="true" 
android:resizeable="true" />

Upvotes: 1

Views: 2543

Answers (2)

CommonsWare
CommonsWare

Reputation: 1007584

If I am correct, Android will scale down the images if someone with MDPI or LDPI screen uses the APP, right?

Yes.

Is there also a setting wherein all different DPI sizes use the 72x72 image?

It should have that effect if you put them in res/drawable/ rather than res/drawable-hdpi/.

And should I specifically define in the Android Manifest what DPI's are supported?

If you wish to preclude your application from appearing in the Market for certain densities, you can use <compatible-screens> for that. Ideally, you have your app work on all densities.

Would this make it work on all devices?

It will allow your app to be installed on all devices. Whether or not it works is up to you. Please remove the android:resizeable attribute (deprecated). You can also remove android:anyDensity (it is true by default).

And scale down the HDPI images?

Yes, it should scale down the HDPI images. It would do that even without this element.

Upvotes: 4

J. Maes
J. Maes

Reputation: 6892

If you only use one size, I would put the images in the drawable folder, not drawable-hdpi/ldpi/xhdpi. In that way, the image in that folder is always used unless there is a specific one available in the other screen resolution specific folders.

I'm not exactly sure what you mean by

Is there also a setting wherein all different DPI sizes use the 72x72 image?

When you put everything in the standard drawable folder, android will always use this image. If you set the width of an image in dp (density independent pixels) instead of plain pixels, it will automatically scale down the image according to the screen density of the user. Take a look at this link from Google to support multiple screens and have a density-independent application.

Or when I leave this empty, will it support all possible devices?

Leave it empty, it will support all possible devices.

I found this for my android manifest file. Would this make it work on all devices? And scale down the HDPI images?:

No it won't, leave it out. Just use density-independent pixels to fit your images and they will be scaled and used fine in your application.

Upvotes: 1

Related Questions