Using image assets and icon assets of Android Studio

View more Tutorials:

1- Vector Asset

Android Studio is an Android development tool, it contains an important asset, that is images and icons. Luckily you can use them in your application.
To import an icon into your project, follow these steps:
On Android Studio right-click the "drawable" folder of the project and select:
  • New >> Vector Asset
  • Select "Asset Type: Clip Art".
  • And click the "Clip Art" button to select an icon you want.
You can change the color of the Icon:
Name the icon:
Now an XML file is created in the drawable directory, it is a VectorDrawable.
<vector android:height="24dp" android:tint="#519C9A"
    android:viewportHeight="24.0" android:viewportWidth="24.0"
    android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#FF000000" android:pathData="M1,21h4L5,9L1,9v12zM23,10c0,-1.1 -0.9,-2 -2,-2h-6.31l0.95,-4.57 0.03,-0.32c0,-0.41 -0.17,-0.79 -0.44,-1.06L14.17,1 7.59,7.59C7.22,7.95 7,8.45 7,9v10c0,1.1 0.9,2 2,2h9c0.83,0 1.54,-0.5 1.84,-1.22l3.02,-7.05c0.09,-0.23 0.14,-0.47 0.14,-0.73v-1.91l-0.01,-0.01L23,10z"/>
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.

2- Convert SVG, PSD to VectorDrawable

Android Studio can also convert SVG, PSD files into VectorDrawable format.
On Android Studio select:
  • File >> New >> Vector Asset
  1. Select "Asset Type: Local file (SVG, PSD)".
  2. Select an SVG or PSD file on your computer.
Android Studio helps convert SVG (Or PSD) files into VectorDrawble format.

View more Tutorials:

Maybe you are interested

These are online courses outside the o7planning website that we introduced, which may include free or discounted courses.