为什么不将诸如mm之类的标准物理长度单位用于触摸UI布局? [英] Why aren't standard physical length units like mm used for touch UI layout?

查看:111
本文介绍了为什么不将诸如mm之类的标准物理长度单位用于触摸UI布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果要布置交互式触摸UI元素(例如按钮),则需要具有合理物理尺寸的东西,以便用户可以舒适地按下它.这样,布置触摸UI就像在电子设备上布置物理按钮和旋钮一样.对于这种物理工程,毫米(或英寸)是首选单位.

If you're laying out an interactive touch UI element, such as a button, you want something with a sensible physical size, so the user can hit it comfortably. In this way, laying out a touch UI is just like laying out physical buttons and knobs on an electronic device. And for this kind of physical engineering, millimeters (or inches) are the unit of choice.

由于某种原因,触摸UI设计似乎并非如此.我认为自己在该主题上的阅读不是很好,但是老实说,我从未见过有人在Android布局文件中使用mm作为单位.但是我见过无数关于"px","dp","sp"和谁知道的争论.

For some reason this doesn't seem to be the case in touch UI design. I don't consider myself extremely well-read in the subject, but I've honestly never seen anybody use mm as a unit in, say, an Android layout file. But I've seen endless debates about "px" vs "dp" vs "sp" vs who knows what.

与设备无关的像素"(在Android 中已定义 就物理长度而言-1dp≈0.16mm)似乎是一种复杂的指定长度的方法.

The "device-independent pixel" (which on Android is defined in terms of physical length - 1dp ≈ 0.16mm) seems like a really convoluted way to specify a length.

为什么不仅仅使用毫米?

Why not just use millimeters?

设备不正确支持这些装置是否存在问题?这是一种文化的东西吗(程序员可能更习惯于以某种像素"而不是物理单位来思考)?发生了什么事?

Is it a problem with devices not supporting these units properly? Is it a cultural thing (programmers might be more used to thinking in "some sorta pixels" rather than physical units)? What's going on?

推荐答案

通常,您会发现移动可用性人员

Generally, you'll find mobile usability folks talking about millimeters. But programmers and visual designers talk about density-independent pixels or points (1 Android "DIP" = 1 iOS "point") because even if you could specify a measurement in millimeters exactly, you'd end up with rounding issues or half-pixel anti-aliasing ugliness:

1mm等于6.3 DIP(精确度取决于屏幕的准确DPI值,因为倾角量化为最接近的120/160/240/320/480/640 dpi).这意味着在标准的G1样式160DIP屏幕上,如果您将按钮指定为(例如)8mm,则该屏幕上的像素为50.4像素-祝您好运,无论以何种精度呈现,或告诉Photoshop结束一行恰好50.4像素.而四舍五入并不能解决很多问题.屏幕仍然是固定的以像素为单位的总宽度,如果您(比如说)布置具有特定大小和填充量的按钮网格,则舍入误差会以使对称变得混乱的方式复合.

1mm equals 6.3 DIP (degree of precision there depends on the exact DPI value of the screen, since dip are quantized to the nearest of 120/160/240/320/480/640 dpi). That means on a standard G1-style 160DIP screen, if you specify a button as (let's say) 8mm, it'd be 50.4 pixels on that screen - good luck rendering that with any degree of precision, or telling Photoshop to end a line exactly 50.4px. And just rounding isn't much of a solution; the screen is still a fixed total width in pixels, and those rounding errors would compound in ways that mess up symmetry if you're (let's say) laying out a grid of buttons with specific sizes and padding amounts.

指定(例如)48DIP更好,因为它可以平滑缩放:160DPI为48px,HDPI(240)为72px,320DPI为96px(iOS术语为AKA 2x),不需要小数像素渲染或舍入.

Specifying that as (let's say) 48DIP is much better, since that smoothly scales: 48px at 160DPI, 72px at HDPI (240) and 96px at 320DPI (AKA 2x in iOS terminology), no fractional pixel rendering or rounding needed.

对于为什么160DPI像素准确地成为密度无关像素的1倍移动测量单位的原因,归咎于前几部iPhone和HTC G1,它们共享该配置.

As to why exactly the 160DPI pixel won out as the 1x mobile unit of measurement for the density-independent pixel, blame the first few iPhones and the HTC G1, which shared that configuration.

这篇关于为什么不将诸如mm之类的标准物理长度单位用于触摸UI布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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