0

I want to change the color of my icon according to material You, like a google app, but the color does not change in any way. All unsuccessfully

it should be like this

or it should be like this

according to the applied theme

James Coyle
  • 9,922
  • 1
  • 40
  • 48
HarshBarash
  • 125
  • 1
  • 7
  • 1
    Does this answer your question? [How to implement themed icons by Material You in my Android App?](https://stackoverflow.com/questions/69800362/how-to-implement-themed-icons-by-material-you-in-my-android-app) – DrHowdyDoo Jan 02 '22 at 08:16

1 Answers1

1

This process does not require Jetpack Compose at all. Android 13 has official support for themed icons. Just follow their steps here: https://developer.android.com/about/versions/13/features#themed-app-icons

To follow their example:

  1. Create a monochrome version of your app icon

  2. Add this to your ic_launcher.xml file, under the <adaptive-icon /> tagset:

    <adaptive-icon>
        <background android:drawable="..." />
        <foreground android:drawable="..." />
        <monochrome android:drawable="@drawable/myicon" />
    </adaptive-icon>
    
  3. Add your icon to your manifest:

    <application
        …
        android:icon="@mipmap/ic_launcher"
        …>
    </application>
    

Note: If android:roundIcon and android:icon are both in your manifest, you must either remove the reference to android:roundIcon or supply the monochrome icon in the drawable defined by the android:roundIcon attribute.

All of that was pulled directly from the Google developer's example.

Oliver Spryn
  • 16,871
  • 33
  • 101
  • 195
  • Thank you! Other resources on this I found didn't mention rounded icon needed to be changed as well, and I couldn't figure out what was wrong. It's working now! – Nathan Nov 27 '22 at 04:49