0

I'm quite new to Android development. My understanding is that you can create several versions of the same image with different sizes and put them into the folders drawable-ldpi, drawable-mdpi, drawable-hdpi.

It seems obvious to me that you can handle this problem "the lazy way" by just resizing one image depending on the device's pixel density. For this I programmatically find out what density the device has, like ldpi. The implementation itself is not the problem. I'm just afraid of any drawbacks (that prevent me later from running the app on different devices).

So, are there any (major) drawbacks of scaling images automatically ?

In which of the three folders do I put the image so that the compiler can find it?

4

3 回答 3

1

Android 会自动缩放并且在某些情况下可以正常工作,但它不适用于许多,尤其是带有重要细节(如文本)的小图像。缩小较大的图像会使这些细节变得模糊。放大较小的图像会更糟。这就是为什么图标文件在 GUI 的早期就具有多分辨率的原因。也就是说,文本缩放非常复杂。询问任何字体设计师,并注意到 Adob​​e 建立了一家自动执行算法的公司。

于 2012-06-25T03:30:04.357 回答
1

您可以将图像放在常规的可绘制文件夹中。这样任何手机都可以找到它。

虽然您可以以编程方式缩小图像,但缩小通常会减少图像细节并导致锯齿。

添加较小的资产也将减少较小手机的内存使用量。请记住,某些 Android 手机的内存非常糟糕(请参阅:HTC 状态),因此任何和所有节省都会有所帮助。

我建议您只用 Photoshop 自己缩小大图像。对于较小的图像,这没什么大不了的。

于 2012-06-25T03:33:24.243 回答
0

它在 mdpi 文件夹中。它会自动改变大小。但不推荐,因为图像质量下降。

于 2012-06-25T03:28:04.837 回答