问题
I have all of my images in the drawable-hdpi folder. And I finished all of my layouts for all screen sizes. But i forgot to put the images in the drawable-mdpi folder and drawable-ldpi folder. If a phone with an mdpi screen density were to download my application would it just use the images in the drawable-hdpi folder? Or would an error occur because there are no images in the mdpi folder?
The only images in the mdpi and ldpi folder is the icon.
回答1:
The phone is gonna take the images from where they're available. The result will be the same than if you had only a "drawable" folder, it is just not a logical name if you have only one drawable folder.
You are not forced to provide resources for every configuration, the system just take care of using the most adapted and is clever enough to do that job. You should read that to fully understand how it works : http://developer.android.com/guide/topics/resources/providing-resources.html#BestMatch
回答2:
Lyrkan is mostly correct. Mdpi phones will take the image from the drawable-hdpi folder. But the system knows that those images are too big for the phone and scale them down for you.
Most of your users won't notice. The only problem is that on phones with mdpi or ldpi screens all the images will get a little bit blurry because they are scaled down on the fly to match the other screen resolution.
回答3:
You can leave your images in one folder, it would be used by all the phones. The different folders are used if you need to load different images for different devices. In fact, the device will start looking in the folder related to its density, if it doesn't find an image usable, it will look in the other folders. Use the different folders to load different images for different densities. If you don't need this feature, leave all your images in one folder only, no matter which.
回答4:
From the link below I found the following quote: http://developer.android.com/guide/topics/resources/providing-resources.html#BestMatch
When selecting resources based on the screen size qualifiers, the system will use resources designed for a screen smaller than the current screen if there are no resources that better match (for example, a large-size screen will use normal-size screen resources if necessary). However, if the only available resources are larger than the current screen, the system will not use them and your application will crash if no other resources match the device configuration (for example, if all layout resources are tagged with the xlarge qualifier, but the device is a normal-size screen).
However, I also found from this link: https://developer.android.com/guide/practices/screens_support.html#support
However, when the system is looking for a density-specific resource and does not find it in the density-specific directory, it won't always use the default resources. The system may instead use one of the other density-specific resources in order to provide better results when scaling. For example, when looking for a low-density resource and it is not available, the system prefers to scale-down the high-density version of the resource, because the system can easily scale a high-density resource down to low-density by a factor of 0.5, with fewer artifacts, compared to scaling a medium-density resource by a factor of 0.75.
来源:https://stackoverflow.com/questions/6812707/what-happens-if-i-leave-all-of-my-images-in-the-drawable-hdpi-folder