本文介绍了-anydpi和-nodpi有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您在Android Studio 1.5.0中使用了Vector Asset向导,则使用该向导导入的任何矢量可绘制XML都将放入res/drawable/.

If you use the Vector Asset wizard in Android Studio 1.5.0, any vector drawable XML you import using that wizard goes into res/drawable/.

但是,build/目录以及生成的APK显示这些XML文件已移至res/drawable-anydpi-v21/资源目录中. -v21部分很有意义,因为VectorDrawable仅在API Level 21+上受支持.但是,-anydpi似乎没有记录.对于原始的导入目标以及构建系统选择将其导入的位置,我都希望-nodpi.

However, the build/ directory, and the resulting APK show that those XML files get moved into a res/drawable-anydpi-v21/ resource directory. The -v21 part makes sense, as VectorDrawable is only supported on API Level 21+. However, -anydpi seems to be undocumented. I would have expected -nodpi, both for the original import destination and for where the build system elects to move it.

有没有人看到有关-anydpi的含义以及与-nodpi的关系的官方声明?我正在寻找实用的效果,而不仅仅是一些代码注释所暗示的.

Has anyone seen official statements for what -anydpi means, and what its relationship is with -nodpi? I am looking for practical effects, not merely what some code comments hint at.

推荐答案

nodpi

例如:

  • drawable- nodpi /dot.png
  • drawable-nodpi/dot.png

该点在xxhdpi上显示较小,在ldpi上显示大

The dot will appear small on xxhdpi, big on ldpi.

但是,资源解析器将匹配特定的限定符(如果存在).

However, the resource resolver will match a specific qualifier if it exists.

例如

  • drawable- hdpi /eg.png
  • drawable- nodpi -v21/eg.xml
  • drawable-hdpi/eg.png
  • drawable-nodpi-v21/eg.xml

在Lollipop(API 21)hdpi设备上,使用位图.

On a Lollipop (API 21) hdpi device, the bitmap is used.

在棒棒糖(API 21)xhdpi设备上,使用了矢量.

On a Lollipop (API 21) xhdpi device, the vector is used.

例如

  • drawable- hdpi /eg.png
  • drawable- anydpi -v21/eg.xml
  • drawable-hdpi/eg.png
  • drawable-anydpi-v21/eg.xml

在Lollipop(API 21)hdpi设备上,使用 vector .

On a Lollipop (API 21) hdpi device, the vector is used.

在棒棒糖(API 21)xhdpi设备上,使用了矢量.

On a Lollipop (API 21) xhdpi device, the vector is used.

注意:在更改Ic3288d0236fe0bff20bb1599aba2582c25b0db32 .

这篇关于-anydpi和-nodpi有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 20:49