Essential Android Enhancing Performance Using Icon Fonts edit forum

How to integrate Icon fonts

In order to use icon fonts, just follow the steps below:

You may create your font icon file from online websites such as icomoon, where you can upload SVG files of the required icons and then download the created icon font. Then, place the .ttf font file into a folder named fonts (name it as you wish) in the assets folder:

Now, create the following helper class, so that you can avoid repeating the initialisation code for the font:

public class FontManager {
  public static final String ROOT = "fonts/";
  FONT_AWESOME = ROOT + "myfont.ttf";
  public static Typeface getTypeface(Context context) {
    return Typeface.createFromAsset(context.getAssets(), FONT_AWESOME);

You may use the Typeface class in order to pick the font from the assets. This way you can set the typeface to various views, for example, to a button:

Button button=(Button) findViewById(;
Typeface iconFont=FontManager.getTypeface(getApplicationContext());

Now, the button typeface has been changed to the newly created icon font.

Open the styles.css file attached to the icon font. There you will find the styles with Unicode characters of your icons:

.icon-arrow-circle-down:before {
  content: “\e001”;
.icon-arrow-circle-left:before {
  content: “\e002”;
.icon-arrow-circle-o-down:before {
  content: “\e003”;
.icon-arrow-circle-o-left:before {
  content: “\e004”;

This resource file will serve as a dictionary, which maps the Unicode character associated with a specific icon to a human-readable name. Now, create the string resources as follows:

  <! — Icon Fonts -->
  <string name=”icon_arrow_circle_down”>&#xe001; </string>
  <string name=”icon_arrow_circle_left”>&#xe002; </string>
  <string name=”icon_arrow_circle-o_down”>&#xe003; </string>
  <string name=”icon_arrow_circle_o_left”>&#xe004; </string>

Now, you may use your font in various views, for example, as follows:


You may also create button text views using icon fonts:

Table Of Contents
64 Menu
97 Enhancing Performance Using Icon Fonts
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close