Android Material Design 笔记 -- Units & measurements

Pixel density(像素密度PPI) 

一英寸中像素的个数称为“像素密度”。

As a result, UI elements (such as a button) appear physically larger on low-density screens and smaller on high-density screens. (高密度屏幕中的控件要比低密度屏幕中的控件小。)

screen density = screen width (or height) in pixels / screen width (or height) in inches

附一: Pixel density 计算器: http://kingscalculator.com/en/other-calculators/pixel-density-calculator

附二:常用屏幕的PPI

Mobile phones
Device name Pixel density (PPI) Display resolution Display size (inches) Year introduced Link
Motorola Razr V3 128 176 x 220 2.2 2004
iPhone (first gen.) 128 320 x 480 3.5 2007
iPhone 4 326 960 x 640 3.5 2010
Samsung Galaxy S4 441 1080 x 1920 5 2013
HTC One 486 1080 x 1920 4.7 2013
LG G3 534 1140 x 2560 5.5 2014

Tablets
Device name Pixel density (PPI) Display resolution Display size (inches) Year introduced Link
iPad (first gen.) 132 1024 x 768 9.7 2010
iPad Air (also 3rd & 4th gen.) 264 2048 x 1536 9.7 2012
Samsung Galaxy Tab S 288 2560 x 1600 10.5 2014
iPad mini 2 326 2048 x 1536 7.9 2013
Samsung Galaxy Tab S 8.4 359 1600 x 2560 8.4 2014

Computer displays
Device name Pixel density (PPI) Display resolution Display size (inches) Year introduced Link
Commodore 1936 ARL 91 1024 x 768 14 1990
Dell E773C 96 1280 x 1024 17 1999
Dell U2412M 94 1920 x 1200 24 2011
Asus VE228DE 100 1920 x 1080 27 2011
Apple Thunderbolt Display 108 2560 x 1440 27 2011
Dell UP2414Q UltraSharp 4K 183 3840 x 2160 24 2014

https://material.io/devices/

Density-independent pixels (dp)

"Density independence" refers to the uniform display of UI elements on screens with different densities.

dp -- 密度无关像素, 能适应不同的屏幕大小,Android界面设计中尽量使用dp作为单位。

dp = (width in pixels * 160) / screen density

例子:32 x 32 px icon with a screen density of 320 equals 16 x 16 dp

Scaleable pixels (sp) (用于字体大小设定)

When developing for Android, scaleable pixels (sp) serve the same function as dp, but for fonts. The default value of an sp is the same as the default value for dp.

Image scaling

Images can be scaled to look the same across different screen resolutions by using these ratios:

Screen resolution

dpi

Pixel ratio

Image size (pixels)

xxxhdpi

640

4.0

400 x 400

xxhdpi

480

3.0

300 x 300

xhdpi

320

2.0

200 x 200

hdpi

240

1.5

150 x 150

mdpi

160

1.0

100 x 100

图片以 mdpi为基准, 乘以系数 1:1.5:2:3:4
https://developer.android.com/guide/practices/screens_support.html#range




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

天天进步2015

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值