Manmohanbadaya / FontAwesomeAndroid

Use the font awesome icon library in android projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FontAwesomeAndroid

Leverage the font awesome icon library (http://fortawesome.github.io/Font-Awesome/) in your android projects. The vector images will remain crisp and clear on all device sizes

Based on "Font Awesome by Dave Gandy - http://fontawesome.io".

Updated to include new fa- namespace instead of icon- namespace to mirror fontawesome.io changes at 4.0

How to include

  1. Add the fontawesome-webfont.ttf file into your assets directory
  2. Add the font_awesome.xml file to your res folder
  3. Add the two classes ButtonAwesome.java and TextAwesome.java to your package path

How to use

There are two ways to use the icons

  1. XML layouts, just include the extended textview or button in your layout, set the text to the string resource icon

     <com.FontAwesome.Example.TextAwesome
         android:id="@+id/tvThumb"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="@string/fa_thumbs_up"
         android:textSize="30sp" />
    
     <com.FontAwesome.Example.ButtonAwesome
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/fa_check" >
    
  2. Create a view programmatically

TextAwesome tvFacebook = new TextAwesome(this);
tvFacebook.setText(this.getResources().getString(R.string.fa_facebook_square));
tvFacebook.setTextSize(TypedValue.COMPLEX_UNIT_SP,50);
layoutMain.addView(tvFacebook, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

See the example project for more details

About

Use the font awesome icon library in android projects

License:GNU General Public License v2.0


Languages

Language:Java 100.0%