Question

I am trying to mix nodpi resources and non-nodpi resources in my application, but it just doesn't work. When I work with nodpi only, the screen size reported is 480x800 (for example) and all the bitmaps are drawn properly. But when I drop a single bitmap in drawable-normal, the resolution is lowered and that is not the behaviour I want.

What I am looking for is to mix assets that are not to be scaled according depending of the screen specs (the nodpi bitmaps) with other bitmaps that I would like android to take charge of choosing the proper size.

In case that doesn't make sense, let me explain it with an example: I want the fonts/buttons/other-UI-elements to scale, but not the background of the game that is supposed to take larger than the size of the screen. The last part must be nodpi (there is simply more scrolling on the smaller size screen).

How can I do that?

Was it helpful?

Solution 2

Ok, I found a solution: when loading the bitmaps that I don't to be scaled, even if they are in the nodpi folder, I specify the option inScaled = false. That way, they are not displayed in very large scale.

I am certainly not understanding everything about the resource systems, because it doesn't seem to make that much sense. But it works.

OTHER TIPS

Let me see if this makes sense. If you have an asset in nodpi folder, you shouldnt have same name asset in another folder, like say drawable-normal. This is because as you said, nodpi means those images shouldnt be scaled, now if you have them in drawable-normal android will automatically try to scale it.Hope this makes sense.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top