viernes, 20 de agosto de 2021

Android: Vector drawables

Since vector drawables were added on api 21 if you have vector drawables and have support for api < 21 the system will generate pngs for all systems below 21. To avoid this:

 1. Enable the use of support library for vector drawables in build.gradle file (app level):

vectorDrawables.useSupportLibrary = true

2. Use app:srcCompat in the image tag in the layout file:

app:srcCompat="@drawable/empty_dice"

3. You’ll also need to add the namespace to the root of the layout:

xmlns:app="http://schemas.android.com/apk/res-auto"

No hay comentarios:

Publicar un comentario