Android的 - 采用大图片在ImageView的或不同的大小的图像 [英] Android - Using large images in an ImageView or different sized images

查看:363
本文介绍了Android的 - 采用大图片在ImageView的或不同的大小的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个仪表盘菜单,在Android上的伟大工程。它有八个ImageViews和作品一样,我需要它。

  -------------------
| | |
| 1 | 2 |
-------------------
-------------------
| | |
| 3 | 4 |
-------------------
-------------------
| | |
| 5 | 6 |
-------------------
-------------------
| | |
| 7 | 8 |
-------------------
 

我用8种不同的图像在一个非常高的分辨率,使它们看起来不错无处不在。我不包括在不同的DPI文件夹中的任何人。我只是有一个大的决议,所有的屏幕尺寸回升。这是不好的做法?如果我真的有不同大小的图像的每个?

解决方案
  

这是不好的做法?

如果它看起来不错,在所有的屏幕密度(和尺寸,你是支持),这是完全正常的。只有你才能确定。

正如我注意到,在另一个答案,这个问题是自动采样,并将得到的质量。

首先,屏幕密度不断增加。我们有 -xxhdpi 设备现在(例如,Droid的DNA)。然而, -xxhdpi 是一个相对较新的除了SDK。如果你的图标是 -xhdpi ,它们将被上采样为 -xxhdpi ,这可能是有问题的。目前, -xxhdpi 设备在数量极少,不过,所以这可能不是重要的时刻。但是,如果你只提供,比方说, -mdpi 图像,Android将需要上采样为 -hdpi 上了,再次引起可能的文物。

下采样是更可能有体面的结果,与上采样进行比较。然而,这是不是质量绝对保证,特别是当你通过几个级别(例如,下采样 -xhdpi -ldpi )。

自定义,各具特色的图像等密度给你绝对的控制权的质量,在开发时间和APK大小的成本。

I have a "dashboard" menu that works great on Android. It has eight ImageViews and works just as I need it.

-------------------
|        |        |
|    1   |    2   |
-------------------
-------------------
|        |        |
|   3    |    4   |
-------------------
-------------------
|        |        |
|    5   |    6   |
-------------------
-------------------
|        |        |
|    7   |    8   |
-------------------

I use 8 different images at a very high resolution so that they look good everywhere. I don't include any of them in different dpi folders. I just have one large resolution that all screen sizes pick up. Is this bad practice? Should I really have different sized images for each?

解决方案

Is this bad practice?

If it looks good at all screen densities (and sizes that you are supporting), this is perfectly fine. Only you can make that determination.

As I note in another answer, the issue is the automatic resampling, and the resulting quality.

First, screen densities keep increasing. We have -xxhdpi devices now (e.g., Droid DNA). However, -xxhdpi was a relatively recent addition to the SDK. If your icons are -xhdpi, they will be upsampled for -xxhdpi, and that could be problematic. At the moment, -xxhdpi devices are extremely few in number, though, so this may not matter for the moment. However, if you are only supplying, say, -mdpi images, Android will need to upsample for -hdpi on up, once again likely causing artifacts.

Downsampling is more likely to have decent results, compared with upsampling. However, it is not an absolute guarantee of quality, particularly as you go through several levels (e.g., downsampling -xhdpi to -ldpi).

Custom-crafting images for other densities give you absolute control over quality, at the cost of development time and APK size.

这篇关于Android的 - 采用大图片在ImageView的或不同的大小的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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