Skip to content

Latest commit

 

History

History
37 lines (35 loc) · 2.02 KB

README.md

File metadata and controls

37 lines (35 loc) · 2.02 KB

AndroidFontAwesomeStrings

String resources for the free FontAwesome icons for use with AndroidStudio.

  1. First create your Font Resource Directory

    1. Right-click the res folder and go to New > Android resource directory
    2. In the Resource type list, select font, and then click OK
    3. Check this guide for more details
  2. Download the FontAwesome TTF files

  3. Add your font files in the font folder

    1. Right-click the font folder and go to Show in Explorer
    2. Move your desired TTF files to this folder
  4. Create your icon dictionary:

    1. Right-click the values resources folder and go to Show in Explorer
    2. Move the XML Files to this folder:
      • XML for Brands Icons: strings_fa_brands.xml
      • XML for Regular Icons: strings_fa_regular.xml
      • XML for Solid Icons: strings_fa_solid.xml
    3. Or check the FontAwesome Cheatsheet to create your own, the XML will look like this:
    <resources>
       <string name="fa_regular_sun">&#xf185;</string>
       <string name="fa_regular_surprise">&#xf5c2;</string>
       <string name="fa_regular_thumbs_up">&#xf164;</string>
    </resources>
  5. In the layout XML file, set the text and fontFamily attribute to the icon you want

    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/fa_regular_thumbs_up"
            android:fontFamily="@font/fa-regular-400"/>