How to Convert SVG, PSD files to XML in Android Studio?

svg to xml android studio

In this article, we’ll learn how to convert SVG and PSD files to XML in Android Studio.

It’s easy to convert the images to XML format. First, open the Android Studio. Right-click on the res folder > New > Vector Asset.

android studio res folder

Select the “Local file (SVG, PSD)” radio button. Next, click on the browse icon and select your image.

android studio vector asset

Click on the “Next” button, then, “Finish” button.

Now, open res > drawable folder. You will find your image in the XML format.

Sometimes, when you open the image, you will get errors (mostly because of color).

android xml errors

There is no currentColor in the project. To fix this, simply set a color.

xml drawable colors

How to Convert Multiple Files at Once?

If you have a lot of files, you can easily convert them using the Resource Manager.

First, put the images in a folder on your computer. In the Android Studio, go to Tools > Resource Manager.

Android Studio Resource Manager

In the Resource Manager pane, click on the + icon, and select “Import Drawables.”

Import Drawables

Navigate to the folder and click on the OK button. You will see a window with all the files. Click on the Next button.

Drawable Files

Next, click on the Import(C) Button.

Drawables

Now, go to the res > drawable folder. You will find your XML files. If you get the same currentColor error, replace it with a color value.

That’s it! This is how you can convert SVG or PSD files to XML format in Android Studio.

Related Articles:


References:

Leave a Comment