用户界面不同的屏幕密度 [英] UI for different screen densities

查看:123
本文介绍了用户界面不同的屏幕密度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白的设计,支持多种屏幕密度的资源配置预选赛的好处,例如:

I don't understand the benefit of resources configuration qualifiers designed to support multiple screen densities, for example :

  • 为MDPI你把100x100像素的图标

  • for an mdpi you put an icon of 100x100 px

对于华电国际,你把150×150像素的图标

for an hdpi you put an icon of 150x150 px

对于xhdpi你把200×200像素的图标

for an xhdpi you put an icon of 200x200 px

然后你的尺寸的ImageView的显示这个图标100×100的这已经保持在不同的大小和密度的多个屏幕的大小。

Then you display this icon in an imageView of dimensions 100 x 100 dip which already maintains its size on multiple screens of different sizes and densities.

为什么我们不使用的图标的xhdpi版本在上面的资源作为基准的资源,使其得到很好的显示流畅的高密度的屏幕,并在同一时间的Andr​​oid将会重新调整,以适合密度较低屏幕为其中的图标xhdpi版本就足够了呢?

Why don't we just use the xhdpi version of the icon in the resources above as a baseline resource so that it gets displayed nice and smooth on higher density screens, and at the same time android will rescale it to fit lower density screens for which the xhdpi version of the icon will be enough anyway?

我希望我清楚我的解释,谢谢

I hope I am clear in my explanation, thanks

推荐答案

您当然欢迎,只是船 -xhdpi 可绘制,并根据需要有Android的下采样。我预计很多开发者做到这一点。

You are certainly welcome to just ship -xhdpi drawables and have Android downsample as needed. I expect that many developers do just that.

不过,请你明白,你不再在你的可绘制看起来像在更低的密度控制。你是把你的信任Android的绘制重采样算法,其中:

However, please understand that you are no longer in control over what your drawables look like on lower densities. You are placing your trust in Android's drawable resampling algorithm, which:

  • 将要超过将桌面操作系统的图形工具,优化的低CPU和内存的使用,因此可能不会好品质;以及

  • is going to be more optimized for low CPU and memory use than would a desktop OS graphics tool, and therefore may not be as good of quality; and

可以通过Android操作系统版本而异

may vary by Android OS version

航运替代的艺术品在不同的密度为您提供更多的控制,虽然更大的发展努力和更大的APK大小。

Shipping alternative artwork in different densities gives you more control, albeit for greater development effort and a larger APK size.

如果你不希望这样的控制,这是你的选择。同时,请不要吝惜其他开发人员的愿望,有控制和有较低的密度设备潜在的更高质量的结果。

If you do not want that control, that is your choice. At the same time, please do not begrudge other developers' desire to have that control and have potentially higher quality results on lower-density devices.

这篇关于用户界面不同的屏幕密度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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