How to change my App's icon in Xamarin.Forms using Visual Studio?

Viewed 6762

I'm new to Xamarin.Forms and I am finding it impossible to change the application's icon for my app.

I used a cross-platform template in VS2017. I changed all the icon files in @mipmap-XXXX. When I run in the emulator the app icon changes but not on my device.

Does anyone have a proven method for getting this working. I'm sure it's possible but I can't find any information that helps.

2 Answers

If you're creating projects using the newest VS/Xamarin update, you should notice a folder in the Android project (under Resources) called mipmap-anydpi-v26, or similar. In this folder, you will find two XML files: icon.xml and icon_round.xml. If you open these files, you'll notice that they reference :

  • launcher_foreground - your icon image.
  • launcher_background - background color of your icon, mainly used for round icons.

When you are assigning the app icon and you reference icon, you are actually referencing the XML file, not the images. The XML file then retrieves the correct image size from the other mipmap folders.

Thanks both for your comments. However, neither completely solved the problem. In the end I looked in the file system and removed all icon.png images. I cleaned and rebuilt the app and nothing changed when I deployed it. I then repeated the above on all the launcher_foreground.png files and replaced them with appropriately sized ones. Now my application icon is what I wanted.

I seems that even though there is a icon.png file in each of the mipmap-xxxx folders, it is the launcher_foreground.png file that holds the application icon.

Related