androidmipmapsandroid-mipmapadaptive-icon

Correct way to use adaptive icons in api 26+


I managed to get my adaptive icons working by creating a folder mipmap-anydpi and placing suggested xml file there (https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive.html#studio)

This worked on api 26, but broke icons on android versions lower than that, they now show default android image. I managed to fix this by renaming my folder to mipmap-anydpi-v26, now icons work as expected on all supported apis.

My question is this, are we supposed to do it like this? Will -v26 make it also work on api 27+ or I have to create separate -v2X folder for each future api?


Solution

  • When you create a folder or a ressource file for a specific screen density or android version, this file becomes, in your case, the default reference for this version and the versions above.

    Hope this helps.