简体   繁体   中英

how to use resources from drawable and drawable-hdpi at the same time?

I have the following problem. From what I have seen if I put my resources in the drawable folder the sdk will scale them automatically if I don't have the anyDensity option in the manifest, but this does not look good on the Galaxy Tab (the icons look too small). I have some specific resources for the 320x480, 480x800, 600x1024. If i put them in the specific drawable folders and not set anyDensity to true they look too big. If I set anyDensity to true they seem to look ok. But the question is, if I don't have resources of different sizes for all the resources can i put some of them in the drawable folder (so the sdk makes the prescaling) and the other ones in the specific drawable folder or I need specific resources for all the resolutions and all the resources.

Thank you.

Yes. Android will select the most appropriate version of the resource to use at runtime automatically. So if you having one version of a picture in the drawable folder, and another in the drawable-hdpi folder, then the app will use the hdpi version if the device has a hdpi screen. If not, it will default to the version in the drawable folder. Just make sure the different versions have exactly the same name and extension. If you only have one version of a picture, it will always use that version. The -xxx extensions to folder names only override default resources.

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