Skip to content

Kevin-Tang/Android_Font_Awesome_Example

Repository files navigation

Android Font Awesome Example Project

Example using Font Awesome icons for Android.

Included in this project is a strings.xml of all free font awesome icons on the latest version (5.10.1).

References

@string/fa_lightbulb - Regular lightbulb icon

@string/fa_cat_solid - Solid cat icon

@string/fa_google_brand - Brand google icon

Introduction

Since API level 26, Android introduced a new feature, Fonts in XML, which lets you use fonts as resources. This project shows you how to add fontawesome icons as a font file in your res directory. To use Fonts in XML on devices running Android 4.1 (API level 16) and higher, using at least Support Library 26.0 is required. Make sure to add support for appcompat-v7 to your app-level gradle.

implementation "com.android.support:appcompat-v7:28.0.0"

Useful Resources

Usage

Referencing Font Icons within a TextView

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="@font/fa_regular"
        android:text="@string/fa_lightbulb"
        android:textColor="@color/colorPrimary" />

Demo

Font Awesome Demo Screenshot

About

Example using Font Awesome free icons for Android on the latest version (5.10.1)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages