Monday, January 9, 2017

How to use SVG images in Android Studio

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. TheVectorDrawableCompat 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:
  1. In Android Studio, open an Android app project.
  2. In the Project window, select the Android view.
  3. Right-click the res folder and select New > Vector Asset.
  4. Some other project views and folders have this menu item as well.
    Vector Asset Studio appears.
    Figure 1. Vector Asset Studio.
  5. If a Need Newer Android Plugin for Gradle dialog appears instead, correct your Gradle version as follows:
    1. Select File > Project Structure.
    2. In the Project Structure dialog, select Project.
    3. In the Android Plugin Version field, change the Android Plugin for Gradle version to 1.5.0 or higher, and click OK.
    4. Gradle syncs the project.
    5. In the Android view of the Project window, right-click the res folder and select New > Vector Asset.
    6. Vector Asset Studio appears.
  6. Continue with Importing a Vector Graphic.

Related Posts:

  • Inheritance Inheritance is one of the concept in object oriented programming language. Inheritance allows the class to use the methods and properties from anot… Read More
  • Android Networking Libray's & Android API level Android API versions Code nameVersion numberInitial release dateAPI levelSupport status Alpha1.0September 23, 20081Discontinued Beta1.1February 9,… Read More
  • About JAVA Introduction to JAVA : Java is a platform independent programming language,Platform independent means program can be executed without operating sy… Read More
  • JAVA Design Patterns Design patterns are very popular among the software developer. A design pattern is a well described solution to common software problem Advantages … Read More
  • About XMPP Chat server XMPP is Extended Messaging and Presence Protocol. As the name suggests it is used for (instant) messaging. It gives the presence of the other … Read More

0 comments:

Post a Comment