关于Android的形象和资产规模资产、形象、规模、Android

由网友(天黑路滑人心杂)分享简介:我需要为我的应用程序明确对图像资源的一些疑问,I need to clarify some doubt about the image assets for my app,如果我在一个XML文件中的东西[图像视图]的高度设定为50浸高度if I specify in an xml file that the h...

我需要为我的应用程序明确对图像资源的一些疑问,

I need to clarify some doubt about the image assets for my app,

如果我在一个XML文件中的东西[图像视图]的高度设定为50浸高度

if I specify in an xml file that the height of something [image view] is 50 dip height

我应该从资源文件夹,选择哪种类型的屏幕?

which type of screen should i choose from the resources folder?

drawable, hdpi, ldpi, mdpi, xhdpi,

有50像素高度的图像,

to have the 50 px height image,

和什么比例更大,更小尺寸的图像相比基本图像,

and what is the percentage for bigger, smaller size images compared to the base image,

就像在iOS上,@ 2倍,是图像的字面大小的2倍,你说编程的正常大小,

like in iOS, @2x, is literally 2 times the size of the image, and you say programatically the normal size,

感谢!

推荐答案

MDPI 是参考密度 - 也就是1 PX上 MDPI 显示等于1畅游。比资产比例为:

mdpi is the reference density -- that is, 1 px on an mdpi display is equal to 1 dip. The ratio for asset scaling is:

ldpi | mdpi | tvdpi | hdpi | xhdpi | xxhdpi | xxxhdpi
0.75 | 1    | 1.33  | 1.5  | 2     | 3      | 4

尽管你并不真的需要担心 tvdpi ,除非你正在开发专门针对谷歌电视还是原来的Nexus 7 - 但即使是谷歌建议简单地使用华电国际的资产。

Although you don't really need to worry about tvdpi unless you're developing specifically for Google TV or the original Nexus 7 -- but even Google recommends simply using hdpi assets.

如果你正在做一个48dip形象,并计划支持多达 xxhdpi分辨率,你应该有一个144px映像启动(192px如果你想本地这意味着,对于xxxhdpi资产),使下面的图像的密度:

What this means is if you're doing a 48dip image and plan to support up to xxhdpi resolution, you should start with a 144px image (192px if you want native assets for xxxhdpi) and make the following images for the densities:

ldpi    | mdpi    | tvdpi    | hdpi    | xhdpi     | xxhdpi    | xxxhdpi
36 x 36 | 48 x 48 | 64 x 64  | 72 x 72 | 96 x 96   | 144 x 144 | 192 x 192

和这些应该在任何设备上显示在大致相同的大小,只要你的密度,特定的文件夹放置在这些(如绘制-xhdpi 绘制 - 华电国际,等等。)

And these should display at roughly the same size on any device, provided you've placed these in density-specific folders (e.g. drawable-xhdpi, drawable-hdpi, etc.)

有关参考,像素密度为它们是:

For reference, the pixel densities for these are:

ldpi  | mdpi  | tvdpi  | hdpi  | xhdpi  | xxhdpi  | xxxhdpi
120   | 160   | 213    | 240   | 320    | 480     | 640
阅读全文

相关推荐

最新文章