Search code examples
androiduser-interfacescreen-size

How to mix nodpi and normal/medium/small/large resources


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?


Solution

  • 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.