How to implement a themed monochrome icon for Material You
Asked Answered
C

1

14

How would I implement a monochrome icon like other google apps so that it matches the dynamic colours picked by Material You?

Crescentic answered 14/2, 2022 at 8:38 Comment(0)
C
20

Open your app icon and add the monochrome android:drawable attribute to the <adaptive-icon> element. For example, in res/mipmap-anydpi-v26/ic_launcher.xml:

<adaptive-icon >
    <background android:drawable="..." />
    <foreground android:drawable="..." />
    <monochrome android:drawable="@drawable/mymonochromeicon" />
</adaptive-icon>

If your try this and it does not work then you need to remove the android:roundIcon element from your AndroidManifest.xml, or, alternatively, also add the <monochrome android:drawable="@drawable/mymonochromeicon"/> tag to your round icon.

Android Studio might give a warning saying Element monochrome is not allowed here however we can ignore this.

Crescentic answered 14/2, 2022 at 8:38 Comment(2)
Will it work in Android 12, targeting SDK version 31? No.Castanon
Because Google opened it up for other developers from Android 13Crescentic

© 2022 - 2024 — McMap. All rights reserved.