Ahmed Aswani
Ahmed Aswani

Reputation: 8659

How to Support Multiple Screens in Android without the need to Provide different bitmap drawables for different screen densities

I need to run my application on multiple devices with diffrent specs. Now I'm trying to get it work on just two: Samsung Galaxy tab p100 and Galaxy tab 7.0 plus the differnces I'm care about now are dpi,the first device is 240 dpi the second is 170 and the version the first runs 2.2 he later 3.2 first I put the Images on the hdpi folder images on 7.0 plus is smaller and ugly so I copied them to mdpi folder works fine but this would double the size of my APK. Is there any way to make android auto fit Images without the need to copy Images?

Upvotes: 1

Views: 1529

Answers (1)

Francesco Vadicamo
Francesco Vadicamo

Reputation: 5542

If you want that images look fine in either the device you have to provide the same images for mdpi and hpdi at differente resolution (see Alternative drawables).

However if you put all you images in mdpi directory only, Android will scale theme for hpdi screens. Remember also you have to use dp and not px for all your dimensions (see Density independence).

You can also be interested in how Android pre-scale and auto-scale resources (see Additional Density Considerations). If you want to force auto-scale, you can add this line in your AndroidManifest.xml:

<supports-screens android:anyDensity="false"/>

Upvotes: 1

Related Questions