How to Use Font Awesome Icons in Android Application

As name tells FontAwesome is an awesome tool for designers and developers which give us scalable vector icons that can be easily customized. You can style a FontAwesome icon as any other fonts such as size, color, shadow, animation, transition etc. FontAwesome offers more than 605 fonts icons in a single collection. You don't need JavaScript to run font awesome and it has infinite scalability which means every icon looks great and awesome at any size you define. Font awesome is free for commercial use and is also desktop friendly.

Android Studio is Slow: How to Make Android Studio Fast
How to Share Android Studio Project on GitHub
Android User Interface (UI) Design Tutorial

In this article, I am going to show how to use the FontAwesome icons and symbols in native android application. To use font awesome icons in android application is very easy; just we place font code instead of text font. FontAwesome icons can be used using android TextView, Button View, etc. means fontawesome icons can be used like normal font and link it to fontawesome TTF file using java code.

Create a New Android Project

Let’s start by creating new android project to use FontAwesome icon package in android application and game with the following information.

Application Name: FontAwesome Icons in Android Application
Company Domain: com.viralandroid
Package Name: viralandroid.com.fontawesomeiconsinandroidapplication

Download and Import FontAwesome Font File

First thing you have to do is to download font awesome font from font awesome official site and import TTF file in android project assets folder. To download the font awesome go to FontAwesome website and click Download Button.

After downloading FontAwesome, unzip the file, there you will see many files and folders. We just need fontawesome-webfont.ttf which is located inside font’s folder.

Then, Go to android studio or any other development environment you have used and create an assets folder inside app/src/main/ directory and paste/place fontawesome-webfont.ttf file inside assets folder which will look like screenshot given below.

Font Awesome fontawesome-webfont.ttf file directory in android studio project
Android Studio Assets Folder Directory

Place FontAwesome Icons Code in Strings.xml File

FontAwesome icons with code
Font Awesome Icons

To place font awesome icons code in android strings.xml file, give a name like normal strings and paste font awesome cheatsheet icons code like below.


To get icons code click here.

Insert FontAwesome Icons in Layouts File

In android layout file, add TextViews, Buttons, etc. to place font awesome icons wherever you want. Sample XML layouts file of android application looks like this.


Your layout is ready; it’s time to work in our java activity file to make working by font awesome fonts. Open your java activity file i.e. MainActivity.java file and place little bit code in onCreate method. MainActivity.java file will looks like below.


You have done all things. Now, run your How to Use Font Awesome Icons in Android Application which will look like output given below.


How to Use Font Awesome Icons in Android Application
Font Awesome Icons in Android 

XML 8079712170111385299
Home item