How to convert a png file to xml resource by Android?

Viewed 72535

I want to convert my png file to xml resource that can be accepteed by android. I converted it by using the website below.

https://convertio.co/fr/png-svg/

Then I downloaded it then put it in resource directory and changed type to xml, but android didn't accept it of course.

2 Answers

In current Android Studio version (3.6 rc1), you can import png image directly. File-> New-> Image Asset.

In the Asset Type, select Image, provide path to your image file and click on Next and Finish buttons.

Android Studio would do the conversion for you.

Related