Skip to content

YamamotoDesu/VectorDrawables

Repository files navigation

A VectorDrawable is a vector graphic defined in an XML file as a set of points, lines, and curves along with its associated color information.
The major advantage of using a vector drawable is image scalability.
It can be scaled without loss of display quality, which means the same file is resized for different screen densities without loss of image quality.
This results in smaller APK files and less developer maintenance.
You can also use vector images for animation by using multiple XML files instead of multiple images for each display resolution.

1. Enable Support

You need to opt in to AndroidX vector support in your app’s build.gradle:

android {
    defaultConfig {
        vectorDrawables.useSupportLibrary = true
    }
}

This flag prevents the Android Gradle Plugin from generating PNG versions of your vector assets if your minSdkVersion is < 21—we don’t need this as we’ll use the AndroidX library instead.

ImageView, ImageButton:

  • Don’t: android:src
  • Do: app:srcCompat

CheckBox, RadioButton:

  • Don’t: android:button
  • Do: app:buttonCompat

How to set VectorDrawables

Dice_Roller_–_activity_main_xml__Dice_Roller_app_

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

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages