Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Material Icons in XML

I want to use the new material icons provided by Google. I find it a bit cumbersome to download each icon individually. Is there a way to do something like:

<ImageButton
  android:src="@android:Icon.Material.IconName"
  .../>

If not, whats the easiest way to include multiple icons in my project? Cheers.

like image 504
Androidicus Avatar asked May 25 '16 10:05

Androidicus


People also ask

Can I use material design icons?

Material Design Icons are available for free on the official Material Design Icons website. You can use them in your Android apps, websites, and designs, and there are no restrictions on how you can use them.

How do you use material icons?

Google's Material Icons provides a long list of icons. Choose any one of them and add the name of the icon class to any HTML element within the < body > tag. In the following example, we have used the icon named accessibility that belongs to the action category.

How do I embed a material icon in HTML?

To embed Google Icons in your HTML web pages you have to add the link of material-icons font library in the <head> section of your HTML file and then add the class material-icons in the <i> or <span> tag of the <body> section along with the name of the icon.


1 Answers

Follow these steps to start Vector Asset Studio:

In Android Studio, open an Android app project. In the Project window, select the Android view.

Right-click the res folder and select New > Vector Asset.

After you open Vector Asset Studio, you can add a material icon as follows:

Select "Material Icon"

Click Choose

Select a material icon

like image 164
Mohammed Sameer Ahmad Avatar answered Nov 05 '22 20:11

Mohammed Sameer Ahmad