Scale factor for xxhdpi android?

我的未来我决定 提交于 2019-12-17 02:52:36

问题


according to http://developer.android.com/training/multiscreen/screendensities.html

The following scale factors are mentioned

xhdpi: 2.0 hdpi: 1.5 mdpi: 1.0 (baseline) ldpi: 0.75

I was wondering what the scale factor would be for xxhdpi?


回答1:


In android.util.DisplayMetrics, you can see that scaling factor is 0.00625:

/**
 * Scaling factor to convert a density in DPI units to the density scale.
 * @hide
 */
public static final float DENSITY_DEFAULT_SCALE = 1.0f / DENSITY_DEFAULT;

Where as DENSITY_DEFAULT is 160 --> scaling factor = 1.0f / 160 = 0.00625.

sizeScale = DENSITY_DEFAULT_SCALE * DENSITY_DPI

From this:

  • ldpi = 0.00625 * 120 -> 0.75
  • mdpi = 0.00625 * 160 -> 1.0
  • hdpi = 0.00625 * 240 -> 1.5
  • xhdpi = 0.00625 * 320 -> 2.0
  • xxhdpi = 0.00625 * 480 -> 3.0
  • xxxhdpi = 0.00625 * 640 -> 4.0

Not exactly a rocket science, but hope this will be useful for someone :)




回答2:


If you look at Metrics and Grids you'll see that xxhdpi is 480 dpi which is 3 times that of the baseline (mdpi @ 1.0). In other words the scale factor for xxhdpi is 3.0



来源:https://stackoverflow.com/questions/18655194/scale-factor-for-xxhdpi-android

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