3
votes

When I created Xamarin.Android project in Visual Studio 2017 2 years ago in Resources folder I had drawable folder and drawable-hdpi, drawable-mdpi, drawable-xhdpi etc. folders. If I remember well I put the image I wanted to use in the application in drawable folder, and if the device the application was running on had big screen, it looked for the image in drawable-xhdpi or drawable-xxhdpi and if there was no image there it got the image from drawable folder. I installed Visual Studio 2017 some months ago and instead of drawable,drawable-hdpi, drawable-mdpi, drawable-xhdpi etc. I have mipmap-anydpi-v26, mipmap-hdpi, mipmap-mdpi, mipmap-xhdpi etc. folders. My question is do I proceed as before, if I want to put and image for all device screen sizes I put it in mipmap-anydpi-v26 and if I want to put an image for a specific device screen size I put it in drawable-xhdpi for example? Does anything change with the new folders?

1
So recently (more than a year ago anyway) Google added the mipmap folders to the Resource hierarchy the use for them and I quote It’s best practice to place your app icons in mipmap- folders (not the drawable- folders) because they are used at resolutions different from the device’s current density. So, The mipmap folders are for placing your app/launcher icons (which are shown on the home screen) in only. Any other drawable assets you use should be placed in the relevant drawable folders as before android-developers.googleblog.com/2014/10/…FreakyAli
In case if this answers your question let me know so I can frame a proper response for you to accept else if you have questions feel free to ask them.FreakyAli
The mipmap folders are only for the launcher icon(the icon I click to start the app). For the rest of images that are in the app I create manually drawable,drawable-hdpi, drawable-mdpi etc. folders and I put the images there. Have I understood right?Pirlo
Yes, you are on the right path xDFreakyAli
The only thing, I wonder why Visual Studio 2017 doesn't create the drawable folders for me anymore. I have to create them manually.Pirlo

1 Answers

2
votes

The mipmap folders are for placing your app/launcher icons (which are shown on the homescreen) in only. Any other drawable assets you use should be placed in the relevant drawable folders as before.

According to the this article:

Why use mipmaps for your launcher icons?

Using mipmaps for your launcher icon is described as best practice by the Android team. The advantage you get is that you can keep resources in the mipmap folders for all device densities and then strip out other resources from the drawable folders that are not relevant to the specific users device density.

It’s best practice to place your app icons in mipmap- folders (not the drawable- folders) because they are used at resolutions different from the device’s current density.

When referencing the mipmap- folders ensure you are using the following reference:

Icon = "@mipmap/icon"