6 years ago (2015-06-11)  Front end and interface Software development |   First to comment  14 
post score 0 times, average 0.0
[Slideup] Catalog

English original reference: https://github.com/liltof/font-awsome-for-android In a previous article, I introduced to you in the WEB front end using FontAwesome fonts. Font-Awesome is an icon collection font designed for Bootstrap, which contains more than 300 commonly used icons.Using Font-Awesome also has the following advantages:

  • 1. Reduced drawing of icons
  • 2. Can set the color and size of the icon
  • 3. Reduce the size of the icon and reduce the size of the apk. Only one icon font file is required. There are no icon files of various sizes, such as HDPI, XHDPI, and other icon sizes.

Android development using FontAwesome icon font

Go to the Font-Awesome homepage and download the Font-Awesome font (fontawesome-webfont.ttf) file and place it under the project's assets directory. Find the string corresponding to the icon you want to use (font-awsome-for-android contains an icon and The corresponding file of the string, the latest correspondence is found in the font-awesome.css file in the css directory of the downloaded Font-Awesome font), the desired icon text is set in the TextView, and then the TextView font is set to Font-Awesome font defined.  

Xml layout file code


Java code

In addition, if you need to use the Font-Awesome icon in the Drawable, you can customize a Drawable, and then use the Drawable in the code. For detailed usage, please refer to the fonticon sample project: https://github.com/shamanland/fonticon In addition to the Font-Awesome icon font, there are other icon fonts, such as http://icomoon.io/


This article has been printed on copyright and is protected by copyright laws. It must not be reproduced without permission.If you need to reprint, please contact the author or visit the copyright to obtain the authorization. If you feel that this article is useful to you, you can click the "Sponsoring Author" below to call the author!

Reprinted Note Source: Baiyuan's Blog>>https://wangbaiyuan.cn/en/fontawesome-icon-font-used-android-development-2.html

Post comment


No Comment


Forget password?