Android O introduces a new icon
format called adaptive icons,
which aim to make
our home screens more
coherent by unifying the
size and shape of all app
icons and opened the door to
interesting visual effects.
With adaptive icons, you
supply a 108 by 108 dp icon,
and the device will
apply a mass shape to it.
Different devices or
third party launches
choose what shape mass to use.
For example, they might use
a simple circle, a rounded
square, or perhaps a squircle.
The mass is at most 72 by 72 dp
but might be smaller in parts.
Mass are guaranteed not to touch
the central 66 dp of your icon.
So this can be
considered a safe zone.
And you should keep
any parts of your icon
that should never be
clipped within this area.
Adaptive icons comprise
two separate layers,
a background and a foreground,
stacked on top of one another.
This allows the device to offer
interesting visual effects
by treating each
layer independently.
For example, a launcher
might apply a parallax effect
when the icon is
moving by translating
the letters at different rates.
That's why your overall asset
is larger than the mass size.
The outer 18 dp on each
side will only ever
be revealed when motion
effects are applied.
To add an adaptive
icon to your app,
create an adaptive
icon definition in XML
like this, where you
can specify which
assets to use for the foreground
and background elements.
Masses will only ever be
used on Android O devices.
You can place this drawable
in the v26 configuration,
so that it overrides your
standard icon on newer devices.
Also new in Android
O is the ability
to use vector ovals
as launcher icons.
Each of the foreground
and background elements
can be a raster asset like
pings or WebP, a vector asset,
or even a color drawable.
The background must
be completely opaque
while the foreground can
contain transparency.
If your app also
offers app shortcuts,
then they should also update
to use adaptive icons.
Shortcuts can be pinned
to the homescreen
right next to app icons,
so they need to fit in.
If you offer a bitmap app
shortcut, such as the user's
photo, then there's a new API
on icon or icon compact classes
to create an adaptive
icon from that.
To help you to
create these icons,
Android Studio 3.0
offers an updated wizard
where you can import or create
the foreground and background
layers.
If you set your target
SDK to version 26
but don't supply
an adaptive icon,
then some launchers,
like the pixel launcher,
will scale down your icon
and place it on a background.
So that's what you need to
know about making your icons
adaptive.
Doing so will ensure they fit
in with other apps on the device
and benefit from the
new possibilities
for displaying them.
