How do I use Android vector images in Android apps?

Please Share On:

In this tutorial, I am going to show you how can you use android vector images in your first Android apps like the below screenshot.

Let’s begin the steps.

1) Open your project

Open your new or existing project in Android Studio. Go to the app -> res -> drawable folder.

2) Select Vector Assets

Right-click on the drawable folder and go to New -> Vector Asset. Click the Vector Asset to open the list of available Android Vecto Assets.

Select Vector Assets

3) Click on Clip Art Icon

Click on clip Art icon to select your chosen clip art vector images.

Click Clip Art Icon

4) Select Icon

Now, from the list of available vector images, choose your app required icon and click OK. In the below image, I have selected the menu, you can see a light blue background color surrounds the icon.

Select Icons

Now, your selected icon will be added under your drawable folder with the name ic_baeline_menu_24.xml.

5) Use in your .xml file

Now, it’s time to use your vector asset in your .xml file. Open your.xml file and add your vector image in your location with a reference @drawable/ic_baseline_menu_24 like the below example.

<androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/blue"
            android:elevation="4dp"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:navigationIcon="@drawable/ic_baseline_menu_24"
            app:title="Toolbars"/>

Output:



Donate to support writers


You may interest on the following topics:

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright @2023. All Right Reserved.


Social media & sharing icons powered by UltimatelySocial