3

I noticed that whenever I tested my app on my Droid X and Droid Bionic, the images where actually fine. But whenever I tested it on Larger devices such as Android Tablet. The image is kinda stretched.

I also have a question about the information below, I tried to make 4 copies of "my_layout.xml" and store it in "layout,layout-small,layout-xlarge,layout-xlarge-land" folders. Each of them contain different sizes of the image. That one did the work, they all look good in any sizes of screen devices. But my problem is, I have 300 or more layouts that contain the same image, does it mean I have to create a copy for each one of them and modify the image size? Is there any other way to solve this?

res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-small/my_layout.xml       // layout for small screen size
res/layout-large/my_layout.xml       // layout for large screen size
res/layout-xlarge/my_layout.xml      // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation

I also tried to make different sizes of the image and store it in "drawable-hdpi,drawable-ldpi,drawable-mdpi" They all look fine in all screen devices except in "5.1 WVGA, 5.4in FWVGA, and 10.1 WXGA"

Like I said before, making different layouts with different sizes solve the problem, but do I really have to create a copy for each one of them and modify the image size? Is there any other way to solve this?

Leon
  • 339
  • 1
  • 7
  • 23

1 Answers1

4

You need not re-size manually & add in "drawable-hdpi,drawable-ldpi,drawable-mdpi" This will increase your APK's size, instead use only one High Resolution image and put it in "drawable-nodpi" or just in "drawable" or drawable-hdpi. Test it in all the devices. It should work fine. Tip: put the image that will look Good in 10.1 WXGA, Automatically, the Lower size screen will look good.

EDIT : Create image of the Ratio 3:4:6:8

Ex: if you have an image of width:120px and Height:90px for low resolution devices (drawable-ldpi), then, for drawable-mdpi is 3:4 (120x4/3) = 160
drawable-mdpi the image size should be W:160px , H:120px
drawable-hdpi the image size should be W:240px , H:180px (twice of ldpi)
drawable-xhdpi the image size should be W:320px , H:240px (twice of mdpi)

Make sure that all your images are of good quality, even if it's of different dimensions.

Refer : How to Support Multiple Screens

VenomVendor
  • 15,064
  • 13
  • 65
  • 96
  • The image size I put on my layout is 400 by 300 which is the actual size of my image. Should I changed it as well? Or just use the wrap_content? – Leon Dec 24 '11 at 19:29
  • Scale it to 3 - 4 times, ie add the image of 1200x900, this image should be of good Quality. The smaller size screen will automatically Scale to its Screen size, it's better if u add only one image of 1200x900 in /drawable-hdpi – VenomVendor Dec 24 '11 at 20:24
  • Well, there is no guarantee that the scaled down image will look good on all devices. It all depends on how this image is used and displayed. It's better to create emulators for different screen sizes/densities and see if it's ok. Also, if the image is really large the resize operation may slow down the app performance – Anton Dec 25 '11 at 03:07
  • i have the same issue, images are not showing in `5.1 WVGA, 5.4in FWVGA` devices, how did you fixed this issue @Leon – Juned Jan 11 '13 at 14:33