android英文文档(1)

尺寸与网格

设备的大小不是区别于物理的大小,还区别于屏幕分辨率,也就是屏幕的像素密度(DPI),为了方便开发者开发不同的屏幕尺寸。假设同一个终端分别放入一个物理尺寸的容器与密度尺寸的容器里面。按照物理区分设备就是手机和平板。按照密度区分尺寸就是LDPI,MDPI,HDPI,XHDPI,然后只需要对几种不同的物理比例尺寸进行创建layout,适配分辨率只需要放置不同不同分辨率的图片适配屏幕像素密度就可以了。

即 根据不同尺寸设置不同layout,根据不同密度放置不同图片

Touchable UI components are generally laid out along 48dp units.

Why 48dp?

On average, 48dp translate to a physical size of about 9mm (with some variability). This is comfortably in the range of recommended target sizes (7-10 mm) for touchscreen objects and users will be able to reliably and accurately target them with their fingers.

If you design your elements to be at least 48dp high and wide you can guarantee that:

  • your targets will never be smaller than the minimum recommended target size of 7mm regardless of what screen they are displayed on.
  • you strike a good compromise between overall information density on the one hand, and targetability of UI elements on the other.

Mind the gaps

Spacing between each UI element is 8dp.



阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页