8.1 The app icon
A prominent app icon is an important feature. Despite of its small size, there are extensive style guides for all platforms. Since app design is out of scope of this guide, we only focus on adding an existing icon to a Xamarin.Forms app.
iOS
On iOS we first need to convert the icon into different resolutions. The following Bash script converts the original image “xamarin.png” into several “icon*.png” images.
#!/bin/bash
for width in 57 114 120 72 144 76 152 29 58 50 100 40 80
do
size=${width}x${width}
convert xamarin.png -resize $size\> -background transparent -gravity center -extent $size icon$size.png
done
These images are then set as app icons, spotlight and settings icons: We open the iOS project options go to Build → iOS Application → Universal Icons and load the icons.
Android
On Android we first add the icon file to the “Resources/drawable” folder. Then we set it as the new app icon: We open the Android project options, go to Build → Android Application → Application icon and use the drop down menu.