0

I know many persons have asked this question, but I really can't get a clear answer. I am new to android, and find it's hard to have my layout work well on all different size devices.Below is the problem:(I put the sprite image in drawable-hdpi folder). On mdpi device with resolution 320*480,the screen looks like this: enter image description here

on hdpi device with resolution 480*800, the screen looks like this: enter image description here both images above looks good, but when on mdpi device with resolution 480*800, the screen is looks bad like this: enter image description here Could you please tell me how to solve this problem? I can't understand why it's mdpi device when its resolution is 480*800?

Charlesjean
  • 566
  • 1
  • 5
  • 16

2 Answers2

1

You should always provide bitmap resources that are properly scaled to each of the generalized density buckets: low, medium, high and extra-high density. This helps you achieve good graphical quality and performance on all screen densities.

To generate these images, you should start with your raw resource in vector format and generate the images for each density using the following size scale:

xhdpi: 2.0
hdpi: 1.5
mdpi: 1.0 (baseline)
ldpi: 0.75

This means that if you generate a 200x200 image for xhdpi devices, you should generate the same resource in 150x150 for hdpi, 100x100 for mdpi, and 75x75 for ldpi devices.

Sunny
  • 14,522
  • 15
  • 84
  • 129
  • 1
    Just to make it perfectly clear for the OP, you then put the different resolution images in the corresponding drawable folders (ldpi, etc.) with the exact same file name. – anthropomo Feb 02 '13 at 05:01
  • the first and the third device are all mdpi device, but with different resolution. In drawable-hdpi folder my image is 66*66, when I put 44*44 size sprite in drawable-mdpi folder, I still get the same effect in the third image. – Charlesjean Feb 02 '13 at 05:06
0

refer this link : http://developer.android.com/training/basics/supporting-devices/screens.html

and add this to your manifest

<supports-screens
    android:anyDensity="true"
    android:largeScreens="true"
    android:normalScreens="true"
    android:resizeable="true"
    android:smallScreens="true" />
techieWings
  • 2,045
  • 2
  • 16
  • 18