Last active
December 28, 2017 13:21
-
-
Save dehghani-mehdi/f6f94b1ea493a1cb1cbc67810f6eb376 to your computer and use it in GitHub Desktop.
[Xamarin.Android] Using custom font
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First you need to put .ttf of the font to Assets folder | |
// Let's say the font file name is: MyFont.ttf | |
// create typeface | |
var typeface = Typeface.CreateFromAsset(Assets, "MyFont.ttf"); | |
// find the TextView | |
var tvTitle = FindViewById<TextView>(Resource.Id.tvTitle); | |
// assign the typeface to the TextView | |
tvTitle.SetTypeface(typeface, TypefaceStyle.Normal); | |
// Find more xamarin gists: https://github.com/dehghani-mehdi/best-xamarin-gists |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment