Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Use custom fonts for Android w/o Custom Renderer

$
0
0

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",
            null
        );

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

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


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>