How can I use Material Design icons in XML on Android?

I managed to clone the git repository of Material Design icons, but now I'm struggling with how to use it.

I want to use icon resources in XML files in XML attributes such as android:icon="@drawable/*** .

therefore, I have been looking for quite a few articles, and not one of them is clear yet. Can someone explain?

+5
source share
4 answers

Your project directory has a folder with the ability to transfer, the path should be: / app / src / main / res / drawable, your icons should be placed in this folder to be used with the @drawable/ command in XML.

Here is a similar question, and here is a link to android drawable importer

+4
source

You do not need to clone the repository to do this. If you are using an updated version of Android Studio, you can directly import individual icons.

Right-click on your folder and select Create> Vector from the menu. From there, the default is to select any of the Material icons to use, or you have the option to use your own SVG files.

+25
source

You need to import drawings into your project - the plugin for android drawable importer is really useful for this

0
source

The easiest way is to click on the image you want to use, click on the copy, then click on the drop-down folder and click paste.

0
source

Source: https://habr.com/ru/post/1236526/


All Articles