Forum Xamarin.Forms

Use custom fonts for Android w/o Custom Renderer

Based on these docs one can use a custom font without a custom renderer for Android in Xamarin.Forms. I tried this approach, with a custom font and system fonts, the font is not recognized. I included the font within the Assets folder and made sure "Build Action" is "AndroidAsset" and "Copy to output directory" is set to "Always Copy".

I referenced the font like this:

        var fontFamily = Device.OnPlatform(
            "Comic Sans MS",
            "Comic Sans MS.ttf#Comic Sans MS",

        label1.FontFamily = fontFamily;
        label2.FontFamily = fontFamily;

Has anybody a working sample, the one in the docs is clearly not working for me?

Best Answer


Sign In or Register to comment.