1

I'm sorry for the odd way of putting the question.

So basically the problem is that I have 3 directories for drawable resources

  • drawable
  • drawable-normal-hdpi
  • drawable-xlarge

with the intention to separate it like this

I want to separate it like this

but it doesn't work.

Because a device with a normal screen and mdpi still picks from normal-hdpi and I don't want this.

I could rename drawable to drawable-normal-mdpi and it would work but then a really small device would complain about not finding resources.

Which leaves me with the option of having to duplicate folder contents from drawable to drawable-normal-mdpi which sounds wrong.

The option of using alias-xml isn't really a help since, as far as I understand, I need to have 2 xml for every-single-drawable and for me this is worse than having a duplicate folder for the lowest resolution.

What can I do to achieve my goal as shown in the image? Thanks for your time.

edit: minSdkVersion="8" targetSdkVersion="15"

SOLVED:

I was able to separate it like in the image by using the directories

  • drawable-mdpi
  • drawable-hdpi
  • drawable-xlarge
unR
  • 1,298
  • 14
  • 21
  • How do you know your device has a "normal" screen? – mtmurdock Jul 25 '12 at 18:26
  • I picked HVGA when I created the AVD. According to the table normal-mdpi is the only option. I also made sure that the dpi setting said 160. – unR Jul 25 '12 at 18:30
  • "Which leaves me with the option of having to duplicate folder contents from drawable to drawable-normal-mdpi which sounds wrong" -- or use [an alias resource](http://developer.android.com/guide/topics/resources/providing-resources.html#AliasResources), which you rejected. Or use hardlinks in your OS to have two directory names point to the same file contents. "What can I do to achieve my goal as shown in the image?" -- for starters, `res/drawable/` has nothing to do with your densities. If you are going to use resource sets, use `res/drawable/` for resizable images, like `ShapeDrawable`. – CommonsWare Jul 25 '12 at 19:08
  • 1
    As to the actual question *"Why does a normal-mdpi device pick from drawable-normal-hdpi instead of the default drawable?"*, the answer is given in [this decision chart](http://developer.android.com/images/resources/res-selection-flowchart.png) and part of a [subsection](http://developer.android.com/guide/topics/resources/providing-resources.html#BestMatch) in the elaborate [Supporting Multiple Screens](http://developer.android.com/guide/practices/screens_support.html) documentation. – MH. Jul 25 '12 at 19:29
  • thanks MH. using the chart and the table I could come up with a system that does exactly what I want. drawable-mdpi, drawable-hdpi and drawable-xlarge. I was worried that large-ldpi and large-mdpi would resort to the low-res version but they do in fact pick drawable-hdpi – unR Jul 25 '12 at 20:42
  • @unR hey i have same problem of image being picked up by my three emulators:240x320_120dpi(LDPI), 320x480_160dpi(MDPI) and 480x800_240dpi.. i have placed an image with same name as logo.png in my all three folder:drawable-ldpi, drawable-mdpi and drawable-hdpi.. but all three emulator picks up image at drawable-mdpi.. Can you please help me..its been two weeks i have been searching for this solution.. – Suraj G Jan 05 '13 at 16:23

0 Answers0