Different image sizes for resolution-specific Drawable folders

我只是一个虾纸丫 提交于 2019-12-13 01:33:27

问题


In the Android res folder, we are presented with a few different folders that deal with different resolutions for images. In the past I have only used one image with the same resolution in one folder, and this has worked well for my specific applications. However, I'm hoping to make my future Android apps look essentially the same across an array of screen resolutions and devices. Any rules or guidelines to go by when creating different resolution sizes for the same image to put in each folder (i.e., should images that go in the medium resolution folder be 1.5x the size of those in a low resolution folder, etc.)?


回答1:


What you're looking for is the scale-factor for each folder. This works by taking the mdpi folder as the "base" scale of 1.0.

Scale-factors for each folder are as follows:

  • ldpi > 0.75
  • mdpi > 1.0
  • hdpi > 1.5
  • xhdpi > 2.0
  • xxhdpi > 3.0
  • xxxhdpi > 4.0

So, for example, taking a 48*48px image as your base mdpi image, you'd end up with 32, 48, 72, 96, 144 and 192px images.

Fore more detail, including the source for each of these values, check out shoe-rat's excellent answer from which I sourced much of this one.



来源:https://stackoverflow.com/questions/23924298/different-image-sizes-for-resolution-specific-drawable-folders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!