I am developing an xamarin Android application and need to use FontAwesome icons in application. But don't know how to use it. Got lot's of articles on internet but it's not clear to me.
How to use FontAwesome icons on Xamarin.Android?
I am developing an xamarin Android application and need to use FontAwesome icons in application. But don't know how to use it. Got lot's of articles on internet but it's not clear to me.
How to use FontAwesome icons on Xamarin.Android?
I have got worked as below:
Copy FontAwesome
ttf file to Assets
folder. Then under OnCreate()
method of Activity
page the control should be referred to the font file as below:
Activity Page:
Typeface font = Typeface.CreateFromAsset(Application.Assets, "fontawesome-webfont.ttf");
TextView txtv = (TextView)FindViewById(Resource.Id.textviewtitle);
txtv.Typeface = font;
.xaml Page:
<TextView android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:editable="false"
android:text="\uf238 Unicode To get FontAwesome icon"
android:textSize="20dp"
android:textColor="#545454"
android:textStyle="bold"
android:padding="6dp"
android:id="@+id/textviewtitle"
/>
As you see above in .xaml
Page code android:text="\uf238 Unicode To get FontAwesome icon"
, I have declared \uf238
. This is unicode
for the particular icon. Every Icon would have unique unicode
. Therefore we should use always unicode
character to get any icon displayed on control or on text.
Found this on web use following github repo to get Xamarin.Plugins it has
Font Awesome, Ionicons, Material design icons, Meteocons
https://github.com/jsmarcus/Xamarin.Plugins/tree/master/Iconize