Convert Figma logo to code with AI

JoanZapata logoandroid-iconify

Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...

3,926
526
3,926
68

Top Related Projects

The iconic SVG, font, and CSS toolkit

Material Design icons by Google (Material Symbols)

This light-weight library provides images with letter/text like the Gmail app. It extends the Drawable class thus can be used with existing/custom/network ImageView classes. Also included is a fluent interface for creating drawables and a customizable ColorGenerator.

Android-Iconics - Use any icon font, or vector (.svg) as drawable in your application.

A support library for VectorDrawable and AnimatedVectorDrawable classes introduced in Lollipop

✒7000+ Material Design Icons from the Community

Quick Overview

Android-Iconify is a library that allows developers to easily add scalable vector icons to their Android applications. It provides a wide range of icon packs and enables the use of icons as text, in TextViews, or as compound drawables.

Pros

  • Extensive collection of icon packs, including FontAwesome, Entypo, and Material icons
  • Easy integration with existing Android views and layouts
  • Supports custom icon fonts
  • Scalable vector icons that look crisp at any size

Cons

  • May increase app size due to inclusion of icon fonts
  • Limited customization options for individual icons
  • Requires additional setup and dependencies
  • Some icon packs may have licensing restrictions

Code Examples

  1. Adding an icon to a TextView:
TextView textView = findViewById(R.id.my_text_view);
textView.setText("{fa-heart} I love Android");
Iconify.addIcons(textView);
  1. Using an icon as a compound drawable:
TextView textView = findViewById(R.id.my_text_view);
textView.setText("Send Email");
IconDrawable icon = new IconDrawable(this, FontAwesomeIcons.fa_envelope);
textView.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
  1. Creating a standalone icon:
IconDrawable icon = new IconDrawable(this, FontAwesomeIcons.fa_star)
    .colorRes(R.color.my_color)
    .sizeDp(24);
imageView.setImageDrawable(icon);

Getting Started

  1. Add the dependency to your build.gradle file:
dependencies {
    implementation 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
    implementation 'com.joanzapata.iconify:android-iconify-material:2.2.2'
}
  1. Initialize Iconify in your Application class:
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Iconify
            .with(new FontAwesomeModule())
            .with(new MaterialModule());
    }
}
  1. Use icons in your layouts or code as shown in the examples above.

Competitor Comparisons

The iconic SVG, font, and CSS toolkit

Pros of Font-Awesome

  • Larger icon set with over 1,600 free icons and 7,800+ pro icons
  • Supports multiple file formats (SVG, webfonts, sprites)
  • Regular updates and additions to the icon library

Cons of Font-Awesome

  • Not specifically designed for Android, requiring additional setup for mobile apps
  • Larger file size due to extensive icon set, potentially impacting app performance

Code Comparison

Android-iconify:

IconDrawable iconDrawable = new IconDrawable(context, FontAwesomeIcons.fa_android)
    .colorRes(R.color.green)
    .sizeDp(24);
imageView.setImageDrawable(iconDrawable);

Font-Awesome (using a third-party Android library):

Icon icon = new Icon("fa-android", 24, Color.GREEN);
imageView.setImageDrawable(icon.getDrawable());

Summary

Android-iconify is specifically designed for Android development, offering easy integration and optimized performance for mobile apps. Font-Awesome, while more versatile and extensive, may require additional setup for Android projects but provides a larger icon set and multi-platform support.

Material Design icons by Google (Material Symbols)

Pros of material-design-icons

  • Comprehensive set of icons directly from Google, ensuring consistency with Material Design guidelines
  • Regular updates and additions to the icon set, keeping it current with design trends
  • Extensive documentation and guidelines for proper icon usage

Cons of material-design-icons

  • Larger file size due to the extensive icon collection, which may impact app size
  • Less flexibility in customization compared to Android-iconify's programmatic approach
  • Requires manual integration into Android projects, potentially more time-consuming

Code Comparison

Android-iconify:

IconDrawable iconDrawable = new IconDrawable(context, FontAwesomeIcons.fa_android)
    .colorRes(R.color.green)
    .sizeDp(24);
imageView.setImageDrawable(iconDrawable);

material-design-icons:

<ImageView
    android:layout_width="24dp"
    android:layout_height="24dp"
    android:src="@drawable/ic_android_24dp"
    android:tint="@color/green" />

Android-iconify offers a more programmatic approach to icon integration, allowing for dynamic customization. material-design-icons relies on XML layouts and drawable resources, which is more static but aligns closely with standard Android development practices.

This light-weight library provides images with letter/text like the Gmail app. It extends the Drawable class thus can be used with existing/custom/network ImageView classes. Also included is a fluent interface for creating drawables and a customizable ColorGenerator.

Pros of TextDrawable

  • Specialized in creating text-based drawables, ideal for initials or simple text representations
  • Offers more customization options for text appearance, including font, size, and style
  • Lightweight and focused on a specific use case

Cons of TextDrawable

  • Limited to text-based drawables, not suitable for complex icons or vector graphics
  • Lacks built-in icon libraries or font icon support
  • May require more manual customization for each drawable

Code Comparison

TextDrawable:

TextDrawable drawable = TextDrawable.builder()
    .buildRound("A", Color.RED);
imageView.setImageDrawable(drawable);

android-iconify:

IconDrawable icon = new IconDrawable(context, FontAwesomeIcons.fa_user)
    .colorRes(R.color.red)
    .sizeDp(30);
imageView.setImageDrawable(icon);

TextDrawable is more focused on creating text-based drawables with customizable appearance, while android-iconify provides a wider range of icon options and font icon support. TextDrawable is better suited for simple text representations, while android-iconify offers more versatility for various icon types and styles. The choice between the two depends on the specific requirements of the project and the desired visual elements.

Android-Iconics - Use any icon font, or vector (.svg) as drawable in your application.

Pros of Android-Iconics

  • More extensive icon library support, including custom fonts and SVG icons
  • Better performance with lazy loading and caching mechanisms
  • More flexible customization options for icons, including color, size, and padding

Cons of Android-Iconics

  • Steeper learning curve due to more complex API
  • Larger library size, which may impact app size

Code Comparison

Android-Iconics:

IconicsDrawable(this, FontAwesome.Icon.faw_android).apply {
    colorInt = Color.RED
    sizeDp = 24
}

android-iconify:

new IconDrawable(this, FontAwesomeIcons.fa_android)
    .colorRes(R.color.red)
    .sizeDp(24);

Both libraries offer similar functionality for creating and customizing icons, but Android-Iconics provides a more Kotlin-friendly API and additional customization options. Android-Iconics also supports a wider range of icon types and fonts, making it more versatile for complex icon requirements. However, android-iconify may be easier to implement for simpler use cases and has a smaller footprint.

A support library for VectorDrawable and AnimatedVectorDrawable classes introduced in Lollipop

Pros of vector-compat

  • Focuses specifically on vector drawable compatibility for older Android versions
  • Provides a more lightweight solution for vector graphics support
  • Offers seamless integration with Android's native vector drawable system

Cons of vector-compat

  • Limited to vector drawables only, not offering additional icon libraries
  • Less actively maintained compared to android-iconify
  • Fewer customization options for icons

Code Comparison

vector-compat:

VectorDrawableCompat vectorDrawable = VectorDrawableCompat.create(
    getResources(), R.drawable.vector_icon, getTheme());
imageView.setImageDrawable(vectorDrawable);

android-iconify:

IconDrawable iconDrawable = new IconDrawable(this, FontAwesomeIcons.fa_android)
    .colorRes(R.color.icon_color)
    .sizeDp(24);
imageView.setImageDrawable(iconDrawable);

vector-compat provides a straightforward way to use vector drawables on older Android versions, while android-iconify offers a more comprehensive icon management system with additional features like icon fonts and customization options. The choice between the two depends on the specific requirements of the project, with vector-compat being more suitable for projects that only need vector drawable support, and android-iconify offering a broader range of icon-related functionalities.

✒7000+ Material Design Icons from the Community

Pros of MaterialDesign

  • Larger icon set with over 7,000 icons
  • Supports multiple file formats (SVG, PNG, Vector Drawable)
  • Regular updates and community contributions

Cons of MaterialDesign

  • Not specifically designed for Android integration
  • Requires more setup and configuration for use in Android projects

Code Comparison

MaterialDesign (using as SVG in Android XML):

<ImageView
    android:layout_width="24dp"
    android:layout_height="24dp"
    app:srcCompat="@drawable/ic_account" />

android-iconify:

<IconTextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="{fa-user}" />

Summary

MaterialDesign offers a vast collection of icons in various formats, making it versatile for different platforms. However, it requires more setup for Android projects. android-iconify, while having fewer icons, provides easier integration for Android developers with its custom views and font-based approach. The choice between the two depends on the project's specific needs, icon variety requirements, and development preferences.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

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 me on twitter @JoanZap if by any chance you're interested. 🙂

Iconify offers you a huge collection of vector icons to choose from, and an intuitive way to add and customize them in your Android app. It has been introduced in this blog post which is a good place to get started.


Install

Pick any number of modules and declare them in your Application.

dependencies {
    compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2' // (v4.5)
    compile 'com.joanzapata.iconify:android-iconify-entypo:2.2.2' // (v3,2015)
    compile 'com.joanzapata.iconify:android-iconify-typicons:2.2.2' // (v2.0.7)
    compile 'com.joanzapata.iconify:android-iconify-material:2.2.2' // (v2.0.0)
    compile 'com.joanzapata.iconify:android-iconify-material-community:2.2.2' // (v1.4.57)
    compile 'com.joanzapata.iconify:android-iconify-meteocons:2.2.2' // (latest)
    compile 'com.joanzapata.iconify:android-iconify-weathericons:2.2.2' // (v2.0)
    compile 'com.joanzapata.iconify:android-iconify-simplelineicons:2.2.2' // (v1.0.0)
    compile 'com.joanzapata.iconify:android-iconify-ionicons:2.2.2' // (v2.0.1)
}
public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        Iconify
            .with(new FontAwesomeModule())
            .with(new EntypoModule())
            .with(new TypiconsModule())
            .with(new MaterialModule())
            .with(new MaterialCommunityModule())
            .with(new MeteoconsModule())
            .with(new WeathericonsModule())
            .with(new SimpleLineIconsModule())
            .with(new IoniconsModule());
    }
}

Show icons in text widgets

If you need to put an icon on a TextView or a Button, use the { } syntax. The icons act exactly like the text, so you can apply shadow, size and color on them!

<com.joanzapata.iconify.widget.IconTextView
    android:text="I {fa-heart-o} to {fa-code} on {fa-android}"
    android:shadowColor="#22000000"
    android:shadowDx="3"
    android:shadowDy="3"
    android:shadowRadius="1"
    android:textSize="40sp"
    android:textColor="#FF..."
    ... />

Icon options

  • Shall you need to override the text size of a particular icon, the following syntax is supported {fa-code 12px}, {fa-code 12dp}, {fa-code 12sp}, {fa-code @dimen/my_text_size}, and also {fa-code 120%}.
  • In the same way you can override the icon color using {fa-code #RRGGBB}, {fa-code #AARRGGBB}, or {fa-code @color/my_color}.
  • You can even easily spin an icon like so {fa-cog spin}.

Show an icon where you need a Drawable

If you need an icon in an ImageView or in your ActionBar menu item, then you should use IconDrawable. Again, icons are infinitely scalable and will never get fuzzy!

// Set an icon in the ActionBar
menu.findItem(R.id.share).setIcon(
   new IconDrawable(this, FontAwesomeIcons.fa_share)
   .colorRes(R.color.ab_icon)
   .actionBarSize());

Extensibility

In case you can't find the icon you want, you can extend the available icon directly from your app. All you need to do is to implement IconFontDescriptor with a .ttf file in your assets and provide the mapping between keys and special characters, then give it to Iconify.with(). You can use the FontAwesomeModule as an example.

There are no constraints on the icon keys, but I strongly suggest you use a unique prefix like my- or anything, to avoid conflicts with other modules. FYI, if there is a conflict, the first module declared with Iconify.with() has priority.

The only dependency you need if you want to use a custom icon is Iconify core.

compile 'com.joanzapata.iconify:android-iconify:2.2.2'

Contributions

License

Copyright 2015 Joan Zapata

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.

It uses FontAwesome font by Dave Gandy, licensed under OFL 1.1, which is compatible
with this library's license.

    http://scripts.sil.org/cms/scripts/render_download.php?format=file&media_id=OFL_plaintext&filename=OFL.txt