Support Library
This technique requires Android Support Library 23.2 or higher and Android Plugin for Gradle 2.0 or higher, and uses vector drawables only. The
VectorDrawableCompat
class in the Support Library allows you to support VectorDrawable
in Android 2.1 (API level 7) and higher.
Before using Vector Asset Studio, you must add a statement to your
build.gradle
file:android { defaultConfig { vectorDrawables.useSupportLibrary = true } } dependencies { compile 'com.android.support:appcompat-v7:23.2.0' }
You must also use coding techniques that are compatible with the Support Library, such as using the
app:srcCompat
attribute instead of theandroid:src
attribute for vector drawables. For more information, see Android Support Library 23.2.Running Vector Asset Studio
To start Vector Asset Studio:
- In Android Studio, open an Android app project.
- In the Project window, select the Android view.
- Right-click the res folder and select New > Vector Asset.
- If a Need Newer Android Plugin for Gradle dialog appears instead, correct your Gradle version as follows:
- Select File > Project Structure.
- In the Project Structure dialog, select Project.
- In the Android Plugin Version field, change the Android Plugin for Gradle version to 1.5.0 or higher, and click OK.
- In the Android view of the Project window, right-click the res folder and select New > Vector Asset.
- Continue with Importing a Vector Graphic.
Some other project views and folders have this menu item as well.
Vector Asset Studio appears.
Gradle syncs the project.
Vector Asset Studio appears.
0 comments:
Post a Comment