[Tutorial] Android Material Icon Library
In this post, I’ll show you how to use Material Icon Library. This is a really good library that can help you choosing over 1000 free material icons to your Android application. You can easily ajust the icon size, color, and more. Let’s check!
I - About Android Tutorials
I’ll be creating a big number of Android tutorials, showing you how to use nice libraries, UI, tips, and more.
I’ll be using Android Studio and Gradle in all tutorials.
If you need some help with any Android lib or feature, feel free to comment here and if possible, I can write a new tutorial about it :)
|Get updates||Follow @aron-bordin|
II - Material Icon Library
This is a really basic and simple library, so this tutorial is quite simple. The original documentation is very good, so you can read more there.
III - Finding a Android Material Icon
The Material Icon provides over 1000 free icons to your application. To find the icons easily, there is a website where you can search and filter them.
So, go to https://materialdesignicons.com/ and find an icon that fits your requirements.
When you click an icon, you will see:
In the library you will use the icon name, replacing
in this example). If you are not using the library, you can use this dialog to download the icon.
IV - Creating the App
Now, let’s start to work with it. Start a new Android Studio project.
Create your app with a Blank Activity, called MainActivity.
Now you can add the Material Icon as a project dependency. Open the
(from module: App).
This is my gradle dependencies:
Download the icon font manually here.
. Feel free to create this folder if it’s not available.
Now, to download and configure everything, build and run your blank app.
V - Using Material icons
To add an icon, there is a View called
that extends the native
This is the XML template to add an icon using the
You must set the icon name at
Change the color and name at
Again, this View extends the
, so fell free to use any feature provided by
The MaterialIconView has some useful methods. This is the list of available methods extracted from project repo:
If you prefer, you can download the demo source code and apk in my gitub.
That’s it, thanks for reading!