能详细说一下为什么加载同一张图片,如果图片放在比设备分辨率低的目录下图片会变大,放在比设备分辨率高的目录下图片会变小的原因吗?
PHPz2017-04-17 17:55:19
First of all, I recommend the official document that Android supports multiple screen sizes that I translated. You will definitely gain something after reading this article: http://blog.csdn.net/wzy_1988....
Then, explain why the image is scaled on different devices.
The scaling of images has nothing to do with the screen resolution, but is related to the screen density.
The default directory is, for example, res/drawable. Android considers this directory without qualifiers to be prepared for mdpi screens. When you do not provide directory resources modified by other qualifiers, the Android system will scale based on the current screen density. For example, hdpi will be expanded by 1.5 times, and xhdpi will be expanded by 2 times.
If you don’t want the image to be scaled, you need to provide images that adapt to different screen densities, and the images need to be correctly placed in the directory modified by the qualifier. For example, drawable-hdpi, drawable-xhdpi, etc.