Hello,
Welcome to our Microsoft Q&A platform!
There are two cases you deal with when working with images in Android:
- You want to load an image for your device density and you are going to use it “as is”, without changing its actual size. In this case you should work with
drawables
and Android will give you the best fitting image. - You want to load an image for your device density, but this image is going to be scaled up or down. For instance this is needed when you want to show a bigger launcher icon, or you have an animation, which increases image’s size. In such cases, to ensure best image quality, you should put your image into
mipmap
folder. What Android will do is, it will try to pick up the image from a higher density bucket instead of scaling it up.
Thus, the rule of thumb to decide where to put your image into would be:
- Launcher icons always go into
mipmap
folder. - Images, which are often scaled up (or extremely scaled down) and whose quality is critical for the app, go into
mipmap
folder as well. - All other images are usual
drawables
.
Update:
my question is why my app is not using the launcher icons I have placed in my mipmap folders. As stated in my original post, I have placed the *.png files in the mipmap folders. It is still showing the launcher icons that come with the template.
For this, you can check document Adaptive icons.
Android 8.0 (API level 26) introduces adaptive launcher icons, which can display a variety of shapes across different device models. For example, an adaptive launcher icon can display a circular shape on one OEM device, and display a squircle on another device. Each device OEM provides a mask, which the system then uses to render all adaptive icons with the same shape.
Specially, pay attention to Creating adaptive icons in XML.
To add an adaptive icon to an app using XML, begin by updating the android:icon
attribute in your app manifest to specify a drawable resource. You can also define an icon drawable resource using the android:roundIcon
attribute. You must only use the android:roundIcon
attribute if you require a different icon asset for circular masks, if for example the branding of your logo relies on a circular shape. The following code snippet illustrates both of these attributes:
<application
…
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
…>
</application>
So , you can change android:icon
and android:roundIcon
to your image.
As a test, when I only changed android:icon
, there is no change for my app on my phone, but if I also changed android:roundIcon
, my app's icon could change accordingly.
Update 2:
If the targetSdkVersion
in your APP is below 26, then you can do without the APP icon adaptation. Android 8.0 will still be backward compatible. But if you specify targetSdkVersion
to 26 or higher, Android will assume that your APP is ready for 8.0, including the application icon.
If you specify targetSdkVersion to 26, but do not use the Android 8.0 app icon adaptation, the icon will look ugly.
So, you need to add adaptive launcher icons for your app.
For this, you can check document :Designing Adaptive Icons .
For more details, you can check: https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive#creating_adaptive_icons_in_xml .
Best Regards,
Jessie Zhang
---
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.