简体   繁体   中英

Android using mix of drawable and drawable-mdpi, ldpi etc

At the moment for my simple game, I have my graphics created with a "default" size in mind (currently 2048x1024, so my backgrounds are 2048x1024 and the other graphics are made to the size needed to look good on that size background). I then, in code, workout what I scale I need for the current device. For example if the current device is 1024x512 (an arbitrary res), I know to scale all graphics by 50%.

This has generally worked well, however (as I am sure some of you have guessed by now), the problem arises with the smaller graphics on small screens. Specifically I have a font that when scaled down to work with a new xperia mini (medium res but small physical dimensions), doesn't look nice.

So what I want is to use the various drawable folders to provide a graphics for "exception" cases only. That is, I don't want to create ldpi, mdpi, hdpi etc versions of every single graphic but rather I want to use the default graphics for most and then the specific graphics for things like this font.

The problem I have is because the other graphics still need to be scaled down based on this default size, these specific graphics are also being scaled down when they don't need to be.

Does anyone have any advice on how I can go about resolving this? Or perhaps there is a way for me to tell that the android system has selected this graphics from the mdpi folder (so that I can then manually decide what I want to do with it)?

Any help very much appreciated.

As far as I know there is no way to find out what folder android use for getting resources (here on SO can be found some questions, but there is no answers). I suppose you can use one resource (eg background) for detecting what size is it, and according to this understand if you want to resize it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM