tags:

views:

50

answers:

0

Hi,

I'm trying to test out using different size images for different density devices. This is what I did:

/drawables-hdpi
   testimg.png (150x150, 72dpi)

/drawables-mdpi
   testimg.png (100x100, 72dpi)

so when I try running this with two emulators (one medium density, the other high density), I see that it correctly picks up the image based on the device density.

I'm just wondering if the image should appear the same exact size relative to other screen elements, for both densities? For example, my layout looks like this:

<LinearLayout android:orientation="vertical">
  <TextView android:text="hello world!" />
  <ImageView android:src="testimg" />
</LinearLayout>

so the text view is just sitting on top of the image, and they're both left-aligned. On the medium density device, the right edge of the image goes up to the "w" in "world". On the high density device, the right edge of the image goes up to the "o" in "world". Is this to be expected, or should the image's right edge fall at exactly the same place on both devices? Since the medium density device is 160dpi, and the high density is 240dpi, and my images are in a 1.5 ratio too, I was expecting the alignment to appear exactly the same. This may just be the font scaling playing tricks on my eyes though,

Thanks