Thursday, May 27, 2010

[android-developers] Desnity-Based Resource Selection

OK, I am seriously confused here and I hope that someone can offer
some thoughts on this...

I have a graphic (test.png) of which I need to include density-
specific versions, so I put a large (150 X 150) version in res/
drawable-hdpi, and a smaller (100 x 100) version in res/drawable-mdpi.
I then include an ImageView, and set the src attribute to @drawable/
test. In the Eclipse Layout editor I can change the configuration
between mdpi and hdpi configurations and the correct version of
test.png is displayed. Unfortunately, when I compile and load onto a
device, the mdpi version is always chosen. The only time the hdpi
version is chosen is if it is the only option. I have tested this on
the Droid and EVO 4G, which are both running Android 2.1 Update 1, and
also the emulator with the same results. For what it's worth, I have
also tested on a Motorola CLIQ (running Android 1.5) and an Ion
(currently running CM 5.0.7) and they get the mdpi version (as
expected, since they are both mdpi devices).

My Setup:

Eclipse 3.5
ADT version 0.9.7

Project Targets Android 2.2 with minSdkVersion set at 3 (Android 1.5).

Any thoughts? Is this something wrong with resource selection or am I
doing something incredibly wrong?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment