0
votes

I want my application components to look in a scaling mechanism. Means image size must look in proportion with screen size.

I know that to use 4 different drawable folders.

Considering hdpi as base (480 x 800) ratio would be:

mdpi 66.66% hdpi 100% xhdpi 133.33%

however xhdpi size accoring to above ration is 640 x 1060. But samsung s3 screen size is 720 x 1280

So suppose If I have image of 100 x 100 in hdpi, and so 133 x 133 in xhdpi

But after applying above rule, Image in samsung s3 not looking proportionality with screen size as image size is based on xhdpi (133 x 133).

Same problem in hdpi with 480 x 854 screen size. Suppose I have to display images on screen, how to filled up that 54 px gap? as our images are based on 480 x 800 in hdpi folder .

So my question is how can we get smaller image for smaller screen size and bigger image for bigger screen size so that all layout and images looks in proportional with screen size?

1
You might find this useful: android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html You can run your images through it and it will output a .zip file with the image scaled for each different display density.Karl
do one simple thing is do not keep all size images. Just keep largest resolution image in "drawable" folder and set imageview property android:adjustViewbounds="true". This property will scale your image proportionality as screen resolution and size.Another benefit of doing so is your application size will reduce by keeping single image of max resolution rather keep all size images.Biraj Zalavadia

1 Answers

0
votes

If you do not compromise not even with a fewer pixels on the screen then it would be ideal for you to use

layout-sw720dp folder for Samsung S3

More info is provided in the official documentation

below are some typical screen widths to be used

res/layout/main_activity.xml # For handsets (smaller than 600dp available width)
res/layout-sw600dp/main_activity.xml # For 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml # For 10” tablets (720dp wide and bigger)

and make your drawable folder like below

xhdpi: 720x1280

large-hdpi: 640x960

hdpi: 480x640

mdpi: 320x480

ldpi: 240x320