How to add Vector icons in Android Studio

Hello Android learners in this tutorial, you are going to learn to add Vector icons in the drawable folder of the Android project. So that later we can use those icons in ImageView or for any other purpose.

Follow the given steps to add Vactor icons.

Step1

Right-click on the res folder and go to new > Vector Asset

How to add Vector icons in Android Studio

Step2

When you will click on VectorAsset, a new small window will open so choose the

  • Clip art
  • Size
  • Name of the clipart

How to add Vector icons in Android Studio

Step3

Click Finish

How to add Vector icons in Android Studio


Now clipart or icon is added successfully!

You will find it on res > drawable

How to add Vector icons in Android Studio


How to use it?

To use clipart with ImageView, use srcCompat attribute.
 app:srcCompat="@drawable/icon_name" 


Output

How to add Vector icons in Android Studio

So in this way, you can add Vector icons in Android Studio.


Read more..

Roadmap to become Android Developer