比例系数为xxhdpi机器人? [英] Scale factor for xxhdpi android?

查看:117
本文介绍了比例系数为xxhdpi机器人?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据<一href="http://developer.android.com/training/multiscreen/screendensities.html">http://developer.android.com/training/multiscreen/screendensities.html

以下规模的因素提到

xhdpi:2.0 华电国际:1.5 MDPI:1.0(基线) LDPI:0.75

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

我想知道的比例因子是什么xxhdpi?

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

推荐答案

在<一个href="https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/util/DisplayMetrics.java">android.util.DisplayMetrics,你可以看到,比例因子是 0.00625

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;

凡为<一个href="http://developer.android.com/reference/android/util/DisplayMetrics.html#DENSITY_DEFAULT">DENSITY_DEFAULT 160 - >缩放因子= 1.0F / 160 = 0.00625

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

sizeScale = DENSITY_DEFAULT_SCALE * DENSITY_DPI

这是这样的:

  • LDPI = 0.00625 * 120 - > < STRONG> 0.75
  • MDPI = 0.00625 * <一href="http://developer.android.com/reference/android/util/DisplayMetrics.html#DENSITY_MEDIUM">160 - > 1.0
  • 华电国际 = 0.00625 * 240 - > < STRONG> 1.5
  • xhdpi = 0.00625 * 320 - > < STRONG> 2.0
  • xxhdpi = 0.00625 * <一href="http://developer.android.com/reference/android/util/DisplayMetrics.html#DENSITY_XXHIGH">480 - > 3.0
  • xxxhdpi = 0.00625 * <一href="http://developer.android.com/reference/android/util/DisplayMetrics.html#DENSITY_XXXHIGH">640 - > 4.0
  • 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 :)

这篇关于比例系数为xxhdpi机器人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆