Firstly
I noticed when creating a new project in Android Studio it generates drawable-v24
folder with ic_launcher_foreground.xml
icon.
And my question is:
drawable-v24
and not in drawable-v21
folder?Secondly
Another generated asset is ic_launcher_background.xml
which is created in res/drawable
folder and was later referenced from mipmap-anydpi-v26/ic_launcher.xml
.
res/drawable
folder and not in res/drawable-v24
or in res/drawable-v26
? Is it due to some nature of mipmap folders?An adaptive icon, or AdaptiveIconDrawable , can display differently depending on individual device capabilities and user theming. Adaptive icons are primarily used by the launcher on the homescreen, but can also be used in shortcuts, the Settings app, sharing dialogs, and the overview screen.
A drawable resource is a general concept for a graphic that can be drawn to the screen and which you can retrieve with APIs such as getDrawable(int) or apply to another XML resource with attributes such as android:drawable and android:icon . There are several different types of drawables: Bitmap File.
svg files for icons and then select local svg option in your vector asset creator to use it in your app.
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 VectorDrawable feature is somewhat integrated in API-24 though it was introduced from API-21. I think Google's developers think API-24+ is ideal or stable for adaptive icons.
For example, Nick Butcher (Android designer + developer @ Google) said in his article: Using vector assets in Android apps (Dec 11, 2018),
- Both nonZero and evenOdd path fillTypes —the two common ways of defining the inside of a shape, often used in SVGs (evenOdd added to platform impl in API 24)
- Gradient & ColorStateList fills/strokes (added to platform impl in API 24)
And about ic_launcher_background
, it is referenced only from mipmap-anydpi-v26/ic_launcher.xml
and mipmap-anydpi-v26/ic_launcher_round.xml
. I think it is just that there is no need to prevent from referencing it directly (It has already prevented by placing ic_launcher.xml
and ic_launcher_round.xml
in mipmap-anydpi-v26
folder). There should be not so far more, deep meanings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With