如何找出使用了哪些可绘制资源? [英] How to find out which drawable resource is used?

查看:53
本文介绍了如何找出使用了哪些可绘制资源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在运行来自ldpi,mdpi,hdpi或xhdpi的应用程序时使用了哪个可绘制资源.

I want to know which drawable resource is used while running the application that is either from ldpi, mdpi, hdpi or xhdpi.

推荐答案

您应该能够按照此处所述获取设备的显示属性.,然后通过将结果与此列表进行比较来确定运行时正在使用哪些资源:

You should be able to get your device's display properties as described here and subsequently determine what resources are being used at runtime by comparing the result against this list:

    lli ldpi:低密度屏幕;约120dpi.
  • mdpi:中等密度(在传统HVGA上)屏幕;约160dpi.
  • hdpi:高密度屏幕;约240dpi.
  • xhdpi:超高密度屏幕;约320dpi.已在API级别8中添加
  • nodpi:这可用于不希望缩放以匹配设备密度的位图资源.
  • tvdpi:屏幕显示介于mdpi和hdpi之间;约213dpi.这不被视为主要"密度组.它主要用于电视,大多数应用程序不需要它-提供mdpi和hdpi资源足以满足大多数应用程序的需求,并且系统会对其进行适当缩放.API级别13引入了该限定符.
  • ldpi: Low-density screens; approximately 120dpi.
  • mdpi: Medium-densit (on traditional HVGA) screens; approximately 160dpi.
  • hdpi: High-density screens; approximately 240dpi.
  • xhdpi: Extra high-density screens; approximately 320dpi. Added in API Level 8
  • nodpi: This can be used for bitmap resources that you do not want to be scaled to match the device density.
  • tvdpi: Screens somewhere between mdpi and hdpi; approximately 213dpi. This is not considered a "primary" density group. It is mostly intended for televisions and most apps shouldn't need it—providing mdpi and hdpi resources is sufficient for most apps and the system will scale them as appropriate. This qualifier was introduced with API level 13.

根据这些信息,您可以推断出以下内容,这可能与您的问题有关:

From this information you can deduce the following, which might also be relevant for your question:

四个主要密度之间的缩放比例为3:4:6:8(忽略tvdpi密度).因此,1dpi的9x9位图是12x12mdpi,hdpi 18x18和xhdpi 24x24.

There is a 3:4:6:8 scaling ratio between the four primary densities (ignoring the tvdpi density). So, a 9x9 bitmap in ldpi is 12x12 in mdpi, 18x18 in hdpi and 24x24 in xhdpi.

这篇关于如何找出使用了哪些可绘制资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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