安卓:如果放置在不同的文件夹中绘制呈现不同的大小相同的图片吗? [英] Android: are images of the same size rendered differently if placed in different drawable folders?

查看:185
本文介绍了安卓:如果放置在不同的文件夹中绘制呈现不同的大小相同的图片吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不呈现绘制,于mdpi文件夹中的相同或不同的绘制,华电国际相同的像素尺寸的图像?

does an image of the same pixel dimensions in drawable-hdpi render the same or different in drawable-mdpi folder?

推荐答案

是的,他们将呈现不同的。

Yes, they will render differently.

每个你提供更高密度的图像时,这些图像将需要有一个较大的尺寸以像素占密度,但出现在DP的大小相同。要DP转换为像素,由设备的密度乘数乘以DP值。 MDPI是1.0,hdpi的是1.5,xhdpi为2.0。因此100dp在华电国际实际上是150像素。

Each time you provide higher density images, those images will need to have a larger size in pixels to account for the density but appear at the same size in dp. To convert dp to pixels, multiply a value in dp by the device's density multiplier. mdpi is 1.0, hdpi is 1.5, xhdpi is 2.0. Therefore 100dp in hdpi is actually 150px.

与100×100像素的绘制,于mdpi / foo.png的图像的应用程序将在150×150像素供应绘制,华电国际/ foo.png同一幅图像的密度更高版本。

An app with an image in drawable-mdpi/foo.png at 100x100 pixels would supply a higher density version of that same image in drawable-hdpi/foo.png at 150x150 pixels.

如果图像是100×100像素,放在-mdpi目录时,它会PTED为具有中等密度间$ P $。在中等密度设备将被渲染为1:1。这同样适用于-hdpi资产的高密度等设备上时,系统使用的资产从一个不同的密度桶比设备本身的密度差异发生。这发生在对设备的本地密度的资产是不可用的。

If an image is 100x100 pixels, when placed in the -mdpi directory it will be interpreted as having medium density. On a medium-density device it will be rendered 1:1. The same applies for -hdpi assets on a high density device, etc. The difference happens when the system uses an asset from a different density bucket than the device's own density. This happens when an asset for the device's native density is not available.

如果一个图像是100×100像素和被放置在-hdpi目录它将PTED作为具有高密度间$ P $。如果有一个中等密度设备上的图像的没有相应-mdpi版,中密度设备将向下缩放图像。 MDPI的密度乘数是1,华电国际的密度乘数为1.5。 1 / 1.5 = 0.66。图像将被缩小到原大小的2/3。

If an image is 100x100 pixels and is placed in the -hdpi directory it will be interpreted as having high density. If there is no corresponding -mdpi version of that image on a medium-density device, the medium density device will scale the image down. mdpi's density multiplier is 1, hdpi's density multiplier is 1.5. 1/1.5 = 0.66. The image will be scaled down to 2/3 of its original size.

这篇关于安卓:如果放置在不同的文件夹中绘制呈现不同的大小相同的图片吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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