DEV Community

loading...

Learning Android: Adaptive Icons

taresin profile image Dougy Lee Updated on ・1 min read

Adaptive icons were introduced in Android 8 (Oreo | API 26) to add a bit of design flair to your launcher icons.

The feature allows the user's OEM to determine a mask to apply onto your launcher icon (e.g. cut a square icon, squircle icon)

Key Points:

  • Foreground/Background layers: 108 x 108 dp
  • Only works with API 26+
    • Move your adaptive icon file to res/mipmap/anydpi-26
  • Icons for earlier versions use 48 x 48 dp icons

Code

Android Manifest

<application
    …
    android:icon="@mipmap/ic_launcher"
    android:roundIcon="@mipmap/ic_launcher_round"
    …>
</application>
Enter fullscreen mode Exit fullscreen mode

res/mipmap/anydpi-26

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@drawable/ic_launcher_background" />
    <foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
Enter fullscreen mode Exit fullscreen mode

Links:

Discussion (1)

pic
Editor guide
Collapse
andikaflying profile image
Andika Kurniawan

I think you should explain adaptive icon in more detail. So, I can get representation about it