[Manifest]关于icon

988 阅读1分钟

总述

Android 7.1<API=25>增加Round Icon Resources,对应Manifest中attribute

android:roundIcon="@mipmap/ic_launcher_round"

Android 8.0<API=26>增加Adaptive Icons,可自动适配不同厂商OEM。 效果如下:

图片

Round Icon

属于Icon 过度阶段,Android 7.1引入。 详请参考:developer.android.com/about/versi…

图片

Adaptive Icons

详情参考:developer.android.com/guide/pract… 遵从自由开放的原则,用于规范不同厂商OEM效果。 图标由三层组成,background layor、foreground layor、mask。 background layor、foreground layor由App指定,mask由OEM决定,可实现效果为圆形、圆角矩形等。 适配8.0,Icon资源放于mipmap-anydpi-v26文件夹中。

图片
图片
可使用Android Studio提供的Image Asset工具实现图标适配及预览效果, 详情参考:developer.android.com/studio/writ…
图片
Adaptive launcher icons are also used in shortcuts(快捷方式,类似Ios 3D-touch), the Settings app, sharing dialogs, and the overview screen(最近任务预览). 注意:

  • Both layers must be sized at 108 x 108 dp.
  • The inner 72 x 72 dp of the icon appears within the masked viewport.
  • The system reserves the outer 18 dp on each of the 4 sides to create interesting visual effects, such as parallax or pulsing.

图片
icon apperence需要在黑圈内,黑圈外部分可能被mask覆盖。

针对Shortcuts:

If you want to apply the same mask and visual effect to your shortcuts as regular adaptive launcher icons, use one of the following techniques:

  • For static shortcuts, use the  element.
  • For dynamic shortcuts, call the createWithAdaptiveBitmap() method when you create them.

For more information on shortcuts, see App Shortcuts.