How to Add icon font in Android (Use IcoMoon)
Most of icon in our first app is use IcoMoon. let’s take a look how to do it.
First, go to IcoMoon app and select any icons you want.
You can also click “Import Icons” button to import custom icon.
If you are finish choose, click “font” button, it will go to the next page. You will see it auto assign Private Use Area of Unicode point for each icon you have selected. You can also choose Latin letters for icon font. But it is better to use PUA characters. You can go to IcoMoon Documentation to get more information.
Finally, click “Download” button to download all related resource of your selection.
Now, let’s see how to apply it to our Android application. It’s also quite simple.
First, decompress the file we just download form IcoMoon App. Than copy the file “icomoon.ttf” witch at the folder named “fonts” to your Android asset folder.
Then in your java file, you have to set the view’s(witch you want to add icon) Typeface and Convert the Unicode point to string and set the it to the view. For example, if you want to add an icon to a TextView. You may write the fallowing codes:
OK, It’s done. Now, you are suppose to seeing the icon appear on the screen.