An android library to display FontAwesome Icons in any View or a MenuItem

Overview

icon-96x96.png DroidAwesome

A library to display FontAwesome Icons in any View or a MenuItem

Download StackShare TravisCI Android Arsenal Codacy Badge

Views Supported:

  • TextView
  • AutoComplete TextView
  • EditText
  • Switch
  • CheckBox
  • Radio Button
  • Button
  • Toggle Button
  • ImageView
  • ImageButton
  • FloatingActionButton
  • MenuItem

Screenshot

Screenshot_1480330061.png Screenshot_1480244308.png

Gradle Setup

Add the following code snippet to module/build.gradle

dependencies {
    compile 'com.lmntrx.livin.library.droidawesome:droid-awesome:1.1.9'
}

Maven Setup

<dependency>
  <groupId>com.lmntrx.livin.library.droidawesome</groupId>
  <artifactId>droid-awesome</artifactId>
  <version>1.1.9</version>
  <type>pom</type>
</dependency>

How to use it?

Define required icons in res/values/icons.xml

<?xml version="1.0" encoding="utf-8"?>
  <resources>
    <string name="android_icon_font_awesome">&#xf17b;</string> //http://fontawesome.io/cheatsheet/
    <string name="not_allowed_font_awesome">&#xf05e;</string>
    <string name="fa_settings_gears">&#xf085;</string>
  </resources>

Now use custom view in activity.xml

<!-- Icons do not render in android studio render sandbox. Run project in an emulator to see changes -->
<com.lmntrx.livin.library.droidawesome.DroidAwesomeAutoCompleteTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="65sp"
        android:textColor="#0f0"
        android:gravity="center"
        android:text="@string/android_icon_font_awesome"/>

<com.lmntrx.livin.library.droidawesome.DroidAwesomeImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:text="@string/not_allowed_font_awesome"
        app:textColor="@color/colorAccent"
        app:textSize="38sp"/>
  • Or in java file
DroidAwesomeTextView textView = new DroidAwesomeTextView(context);
textView.setText(getString(R.string.your_icon_string));

Or

//TextView, EditText, Button, etc.
TextView textView = new TextView(context);
textView.setText(
                new DroidAwesome.StringBuilder(this)
                        .icon(getString(R.string.android_icon_font_awesome)) //icon
                        .build()
        );

//Imageview, ImageButton, FloatingActionButton, etc.
Imageview imageView = new Imageview(context);
imageView.setImageDrawable(
                new DroidAwesome.DrawableBuilder(this)
                        .color(R.color.colorPrimaryDark) //colorRes
                        .size(75f) //dimension float (sp)
                        .icon(getString(R.string.fa_settings_gears)) //icon
                        .build()
        );

To use with menu items

<!--XML-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.lmntrx.livin.droidawesome.MainActivity">
    <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:title="@string/action_settings"
        />
</menu>
//Java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);
    MenuItem menuItem = menu.findItem(R.id.action_settings);
    menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    menuItem.setIcon(
                new DroidAwesome.DrawableBuilder(this)
                        .icon(getString(R.string.fa_settings_gears)) //icon
                        .color(R.color.colorAccent) //colorRes
                        .size(25f) //dimension float (sp)
                        .build()
        );
    return true;
}

ChangeLog

1.1.9

  • Removed use of font file from assets
  • Removed setFontFile() method

1.1.8

  • Minor Bug Fixes

1.1.7

  • Set Font Filename

1.1.6

  • Minor Bug Fix

1.1.5

  • Added DrawableBuilder and StringBuilder
  • Deprecated setFontIcon() and getFontIcon methods

1.1.4

  • Added setIcon() method to ImageView, ImageButton, FAB

1.1.3

  • Minor Bug Fixes
  • Updated build version and support library

1.1.2

  • Minor Bug Fix

1.1.1

  • Add FontAwesome icon programmatically
  • Added support for MenuItem

1.1.0

  • Added ImageView
  • Added ImageButton
  • Added FloatingActionButton

1.0.1

  • Minor Bug Fix

1.0.0

  • Added custom TextView
  • Added custom AutoComplete TextView
  • Added custom EditText
  • Added custom Button
  • Added custom ToggleButton
  • Added custom Switch
  • Added custom CheckBox
  • Added custom Radio Button

Credits

Icon designed by Aswin CJ

BehanceProfile GitHubProfile

Copyright

Copyright 2016 DroidAwesome - Livin Mathew

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...
Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...
Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...

Note: Due to lack of time, Iconify is no longer maintained and icon packs are outdated. I'd be very happy to welcome a new contributor, please reach m

Over 1600 customizable icons for Android including 750+ Google Material Design icons, 25 ready-made social badges, and more!
Over 1600 customizable icons for Android including 750+ Google Material Design icons, 25 ready-made social badges, and more!

droidicon - Over 1600 icons for Android! Icons From... Google Material Design FontAwesome Iconic Entypo Meteocons Unicode Icons Your own custom icons

Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling.
Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling.

Android Week View Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling. Fea

Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling.
Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling.

Android Week View Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling. Fea

Library containing over 2000 material vector icons that can be easily used as Drawable or as a standalone View.
Library containing over 2000 material vector icons that can be easily used as Drawable or as a standalone View.

Material Icon Library A library containing over 2000 material vector icons that can be easily used as Drawable, a standalone View or inside menu resou

ActionsContentView is an standalone library implements actions/content swiping view (AKA Side Navigation UI Pattern, AKA Facebook side menu).  The library doesn't use any specific code introduced in new Android SDK versions. This allows develop an application with an action/content swiping view for every version of Android from 2.2 and up. This is a specified proportion to the size of the Layout or View support library, with which you can easily set a fixed ratio of the size of the Layout or View, internal adaptive size calculation, completely abandon the code to calculate the size! If you have any questions in the course or suggestions, please send an e-mail to the following e-mail, thank you! BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.
BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.

BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.

DevTools for Android Chrome — works on any website, on any Chromium browser.
DevTools for Android Chrome — works on any website, on any Chromium browser.

DevTools for Android Chrome — works on any website, on any Chromium browser.

Com.hhvvg.anytext - An application provides features to modify any TextView in any other applications

AnyText What's this This application provides features to modify any TextView in

Automatically generates UI demos which allow users to call any function with any parameters
Automatically generates UI demos which allow users to call any function with any parameters

Automatically generates UI demos which allow users to call any function (including composable ones) with any parameters. Useful for building demo screens in playground apps of various design systems.

An android app which allows users to display the data of any excel sheet in rows and columns
An android app which allows users to display the data of any excel sheet in rows and columns

ExcelReader App description An android app which allows users to display the data of any excel sheet in rows and columns. Features Display data of an

a solution that can help developers display pictures in any shape.
a solution that can help developers display pictures in any shape.

android-anyshape With the solution, pictures can be displayed in any shape on Android platform. Effect The left is the UI using normal ImageViews, and

ComicsShow app: Display comics and search for any favourites one

ComicsShow app: Display comics and search for any favourites one. Technologies used: Koin: For injecting class and providing modules on runtime :). Vi

CircularStats - Custom Widget to display stats of any thing

CircularStats This is a custom widget made with Jetpack Compose for displaying s

Display's information about SpaceX crew members and ships by consuming a rest api and storing the data to display when the user is offline.

Space-X App Display's information about SpaceX crew members(look for ‘Crew’ section in rest api docs) and ships (look for ‘Ships’ section in rest api

ToggleIconView is a collection library of animated two-stage toggle icons for Android.
ToggleIconView is a collection library of animated two-stage toggle icons for Android.

ToggleIconView ToggleIconView is a collection library of animated two-stage toggle icons for Android. Installation JitPack repository // Project level

Library for Sliding Tab With Color Icons!

Sliding Tab With Color Icons Sliding Tab With Color Icons! Kindly use the following links to use this library: In build.gradle (Project) allprojects {

Comments
Releases(v1.1.9)
Owner
Livin
Livin
A lightweight Android library for use iconic fonts.

Print A lightweight Android library for use iconic fonts. Download Gradle: compile 'com.github.johnkil.print:print:1.3.1' Maven: <dependency> <gro

Evgeny Shishkin 202 Dec 27, 2022
A lightweight Android library for use iconic fonts.

Print A lightweight Android library for use iconic fonts. Download Gradle: compile 'com.github.johnkil.print:print:1.3.1' Maven: <dependency> <gro

Evgeny Shishkin 202 Dec 27, 2022
Android Library to use custom fonts with ease.

FontometricsLibrary A Simple Android Library to use Custom Fonts with Ease. Use Customs Fonts in your Android project without adding any .ttf/.otf in

Ishmeet Singh 188 Nov 15, 2022
Fontize is an Android library that enables multi-font selection functionality to diversify your app.

Fontize Android Library Built with ❤︎ by Gourav Khunger Fontize is an Android library, written in kotlin, that enables your android app have multiple

Gourav Khunger 8 Nov 28, 2022
A library that gives full control over text related technologies such as bidirectional algorithm, open type shaping, text typesetting and text rendering

Tehreer-Android Tehreer is a library which gives full control over following text related technologies. Bidirectional Algorithm OpenType Shaping Engin

Tehreer 61 Dec 15, 2022
Custom fonts in Android the easy way...

This version of Calligraphy has reached its end-of-life and is no longer maintained. Please migrate to Calligraphy 3! Calligraphy Custom fonts in Andr

Christopher Jenkins 8.6k Jan 3, 2023
Typeface helper for Android

Android Typeface Helper Android lacks proper support for custom typefaces. Most obvious method of defining typeface for UI elements via XML attributes

Norbsoft Sp. z o.o. 756 Aug 8, 2022
Helper object for injecting typeface into various text views of android.

TypefaceHelper Helper object for injecting typeface into various text views of android. Overview We can use various custom typefaces asset for any tex

Drivemode, Inc. 105 Nov 25, 2022
This library offers a simple method to add a small badge icon to your ActionBar-MenuItem

Android-ActionItemBadge ActionItemBadge is a library which offers a simple and easy to use method to add a badge to your action item! Screenshots Incl

Mike Penz 1.3k Jan 1, 2023
About-icons - Android library to easily give credit if using icons which require attribution

Android About Icons Library About this project Features How to use Planned improvements Screenshots Contribute Apps using this library License About t

Niko Diamadis 4 Nov 6, 2022