Android 常用参考文档

本文记录安卓开发过程中常用的参考数据。

1. API Level 与系统版本号对应关系

系统版本号API Level版本代号发布时间
Android 1130R
Android 10.029Q
Android 9.028P
Android 8.127O
Android 8.026O2016.08
Android 7.024-25N2016.08
Android 6.023M2015.10
Android 5.122Lollipop_mr1
Android 5.021Lollipop
Android 4.4w20KITKAT_WATCH
Android 4.419KITKAT
Android 4.318JELLY_BEAN_MR2
Android 4.2, 4.317JELLY_BEAN_MR1
Android 4.1, 4.1.116JELLY_BEAN
Android 4.0.3, 4.0.415ICE_CREAM_SANDWITCH_MR1
Android 4.0, 4.0.1, 4.0.214ICE_CREAM_SANDWITCH
Android 3.213HONEYCOMB_MR2
Android 3.1.X12HONEYCOMB_MR1
Android 3.0.X11HONEYCOMB
Android 2.3.3, 2.3.410GINGERBREAD_MR1
Android 2.3, 2.3.1, 2.3.29GINGERBREAD
Android 2.2.X8FROYO
Android 2.1.X7ECLAIR_MR1
Android 2.0.16ECLAIR_0_1
Android 2.05ECLAIR
Android 1.64DONUT
Android 1.53CUPCAKE
Android 1.12BASE_1_1
Android 1.01BASE2008.09

戳我查看官方文档

2. dp和px换算关系对照表

为了适配多种分辨率,我们要按照 3:4:6:8 的比例来为上述资源文件夹设计图片文件,具体如下:

分辨率DPI示例设备换算比例像素备注
ldpi120Galaxy Y0.75x1dp = 0.75px
mdpi160Galaxy Tab1.0x1dp = 1px
hdpi240Galaxy S II1.5x1dp = 1.5px
xhdpi320Nexus 42.0x1dp = 2px720p
xxhdpi480Nexus 53.0x1dp = 3px1080p
xxxhdpi640Nexus 64.0x1dp = 4px

这里需要注意的是图片文件,当系统根据当前设备的 dpi 在相应文件夹下没有找到图片文件,而其他 dpi 文件夹中存在该图片文件时,系统会对该图片进行一定比例的缩放,然后展示在界面上。
比如,有一张给 xxhdpi 屏幕用的图片,本来应该放在 xxhdpi 文件夹中的,但是误放在了 hdpi 文件夹中,系统会先找到 hdpi 文件夹中的图片,想了一会儿:这是给 hdpi 屏幕用的,图片分辨率较低,当前设备的屏幕是 xxhdpi,所需图片分辨率较高,所以我应该将该图片放大展示,放大几倍呢?480/240 = 2 倍,哈哈,我感觉自己好贴心,好周到啊!其实,效果是错误的,而且很可能造成 OOM。

3. 图标尺寸一览表

Launcher icons
Three-dimensional, front view, with a slight perspective as if viewed from above, so that users perceive some depth.

尺寸(px)格式备注
48 × 48 (mdpi).png
72 × 72 (hdpi).png
96 × 96 (xhdpi).png
144 × 144 (xxhdpi).png
192 × 192 (xxxhdpi).png
512 × 512 (Google Play store).png

Action bar, Dialog & Tab icons
These icons are used in the action bar menu. The first number is the size of the icon area, and the second is file size.

尺寸(px)格式备注
24 × 24 area in 32 × 32 (mdpi).png
36 × 36 area in 48 × 48 (hdpi).png
48 × 48 area in 64 × 64 (xhdpi).png
72 × 72 area in 96 × 96 (xxhdpi).png
96 × 96 area in 128 × 128 (xxxhdpi).png

Small Contextual Icons
Small icons are used to surface actions and/or provide status for specific items. For example, in the Gmail app, each message has a star icon that marks the message as important.

尺寸(px)格式备注
16 × 16 (mdpi).png
24 × 24 (hdpi).png
32 × 32 (xhdpi).png
48 × 48 (xxhdpi).png
64 × 64 (xxxhdpi).png

Notification icons
These are used to represent application notifications in the status bar. They should be flat (no gradients), white and face-on perspective.

尺寸(px)格式备注
22 × 22 area in 24 × 24 (mdpi).png
33 × 33 area in 36 × 36 (hdpi).png
44 × 44 area in 48 × 48 (xhdpi).png
66 × 66 area in 72 × 72 (xxhdpi).png
88 × 88 area in 96 × 96 (xxxhdpi).png

参考文献:

  • http://iconhandbook.co.uk/reference/chart/android/
  • https://www.google.com/design/spec/style/icons.html
  • https://www.creativefreedom.co.uk/icon-designers-blog/simple-android-icon-size-guide-for-lollipop-5-1/
  • https://www.google.com/design/spec/patterns/notifications.html#
  • https://www.google.com/design/spec/style/icons.html#icons-system-icons
  • http://petrnohejl.github.io/Android-Cheatsheet-For-Graphic-Designers/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值