Use Font Awesome icons in android apps

Robert Haba
Robert Haba
3 min read
Use Font Awesome icons in android apps
Trust this source on Google
Add trusted source

Font Awesome is a widely used icon toolkit that may be found on a variety of websites. It features both a free and a paid icon collection, but the free collection has the majority of the icons. Unicode () will be used to represent each icon. In TextView, we utilize this unicode to display the icon. All text styling elements (color, size, paddings, etc.) can be added because it’s a regular TextView.

If you wish to display the android Robot logo, for example, you can use unicode as the TextView value.

1. Font Awesome Android Library

To use the Font Awesome icon collection, simply add the font awesome font files to your assets and apply the relevant fontFace to the TextView, which is a much easier operation. However, we’d like the icons to appear in other widgets as well, such as Buttons, Menus, Bottom Navigation, and Navigation Drawer. It requires some effort to display an icon in a non-textual view. As a result, I created a library that has all of the essential methods for rendering icons in numerous widgets.

To get started, include the fontawesome in your build.gradle and sync your project.

dependencies {
    // font awesome
    implementation 'info.androidhive:fontawesome:0.0.5'
}

2. How to use it?

(adsbygoogle = window.adsbygoogle || []).push({});

Displaying Icon in TextView

Using the FontTextView text and specifying the proper icon name as text value is the simplest way to display the font icon. Because this widget is derived from AppCompatTextView, it inherits all of the text view properties.

<info.androidhive.fontawesome.FontTextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/fa_calendar_check_solid"
            android:textColor="@color/icon_color"
            android:textSize="@dimen/icon_size"
            app:solid_icon="true" />
  • solid_icon: To display solid icon, set this value as true.
  • brand_icon: To display brand icon, set this value as true.

Using FontDrawable

Using the icon in xml layout is easy, but if you want to use the icon for other widget like button or menu, you can use the FontDrawable element to apply the icon.

For an example, if you want to use the font awesome icon to Floating Action Button, you can use the FontDrawable as shown below.

FloatingActionButton fab = findViewById(R.id.fab);
 
// using paper plane icon for FAB
FontDrawable drawable = new FontDrawable(this, R.string.fa_paper_plane_solid, true, false);
 
// white color to icon
drawable.setTextColor(ContextCompat.getColor(this, android.R.color.white));
fab.setImageDrawable(drawable);

Using in Menus (Bottom Navigation, Navigation Drawer etc.,)

You can also use font icons in widgets that use the menu file to generate elements like Toolbar icons, Bottom Navigation, and Navigation Drawer, among others. You can use the FontDrawable to configure the icons in menus, however it requires a few hacks using java code.

The below example shows rending the font awesome icons in Navigation Drawer menu. Full example can be found here.

public class MainActivity extends AppCompatActivity
        implements NavigationView.OnNavigationItemSelectedListener {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        intDrawerLayout();
    }
 
    /**
     * Changing navigation drawer icons
     * This involves looping through menu items and applying icons
     */
    private void intDrawerLayout() {
        NavigationView navigationView = findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);
 
        ImageView iconHeader = navigationView.getHeaderView(0).findViewById(R.id.nav_header_icon);
        FontDrawable drawable = new FontDrawable(this, R.string.fa_font_awesome, false, true);
        drawable.setTextColor(ContextCompat.getColor(this, android.R.color.white));
        drawable.setTextSize(50);
        iconHeader.setImageDrawable(drawable);
 
        int[] icons = {
                R.string.fa_home_solid, R.string.fa_calendar_alt_solid, R.string.fa_user_solid,
                R.string.fa_heart_solid, R.string.fa_comment_solid, R.string.fa_dollar_sign_solid, R.string.fa_gift_solid
        };
        renderMenuIcons(navigationView.getMenu(), icons, true, false);
 
        int[] iconsSubmenu = {R.string.fa_cog_solid, R.string.fa_sign_out_alt_solid};
 
        renderMenuIcons(navigationView.getMenu().getItem(7).getSubMenu(), iconsSubmenu, true, false);
    }
 
    /**
     * Looping through menu icons are applying font drawable
     */
    private void renderMenuIcons(Menu menu, int[] icons, boolean isSolid, boolean isBrand) {
        for (int i = 0; i < menu.size(); i++) {
            MenuItem menuItem = menu.getItem(i);
            if (!menuItem.hasSubMenu()) {
                FontDrawable drawable = new FontDrawable(this, icons[i], isSolid, isBrand);
                drawable.setTextColor(ContextCompat.getColor(this, R.color.icon_nav_drawer));
                drawable.setTextSize(22);
                menu.getItem(i).setIcon(drawable);
            }
        }
    }
}
Featured Deal
1 / 5
DEAL!
Samsung Galaxy Watch Ultra (2025)

Samsung Galaxy Watch Ultra (2025)

5.0 / 5.0
$449.99$649.99-31%
Buy
Samsung Galaxy Watch 8

Samsung Galaxy Watch 8

4.9 / 5.0
$289.99$349.99-17%
Buy
👑A good choice
Apple iPhone 17 Pro

Apple iPhone 17 Pro

4.8 / 5.0
$1,012.97$1,099.00-8%
Buy
Google Pixel 9

Google Pixel 9

5.0 / 5.0
$544.99$799.00-32%
Buy
💎Best Android Device
Samsung Galaxy S26 Ultra

Samsung Galaxy S26 Ultra

4.9 / 5.0
$1,212.85$1,499.99-19%
Buy
* As an Amazon Associate, Droid Tools earns from qualifying purchases. Disclosure.
Founder · Editor-in-Chief
Robert Haba is the founder and editor-in-chief of Droid Tools. A lifelong gadget enthusiast with over a decade following the Android ecosystem, he built this publication to cut through the noise and give readers honest, real-world coverage of the tech they actually use.

Comments & Discussions

Join the conversation! We use Disqus to handle comments. Click the button below to load the comment section.

Keep Reading

WhatsApp is finally addressing one of the biggest gaps in its web client, as WhatsApp Web now supports audio and video calls. This requires no download or installation, since it&#8217;s built directly into WhatsApp Web, which has also picked up support for screen sharing, reactions, and a dedicated Calls tab showing full call history and [&hellip;]

whatsapp web desktop
NewsRobert HabaJuly 29, 2026

Practically every streaming service not named Netflix has turned to bundling over the past few years, with competitors teaming up to deliver combo packs like Disney+ and HBO Max. No service has been bundled quite as often as Peacock, though, and YouTube Premium subscribers are now joining the long list of ways to gain access [&hellip;]

peacock youtube premium
NewsRobert HabaJuly 27, 2026

The invites for Google&#8217;s Pixel event just landed, and the leaks have already laid out a stacked rundown of the Google Pixel 11 and Tensor G6. Tech forums have already made up their minds. Going by the leaks, the G6 looks like a regression. The G6 comes up short on CPU cores, and its graphics [&hellip;]

google tensor g6 image
NewsRobert HabaJuly 27, 2026

Google is set to unveil the Pixel 11 family on August 12, and just ahead of that event, the company&#8217;s VP of Devices and Services, Shakil Barkat, has confirmed what many were expecting: prices are going up across the lineup. Google Confirms Pixel Price Adjustments Barkat explained that, like other consumer tech companies, Google is [&hellip;]

Google Pixel 11
NewsRobert HabaJuly 26, 2026