0
votes

I have custom label with custom renderer. In renderer (overrided OnElementChanged method to be exact) I am setting properties like FontFamily and FontSize as follows: view.FontFamily = "Helvetica_Light_Normal.ttf#Helvetica_Light-Normal"; view.FontSize = 20; and then I set text to control. In Android 7.1 (Nexus 6) it works fine and font is applied to label, but in Android 8.0 (Xiaomi Mi 6) it doesn't. I tried many solutions like setting font in xaml, for particular platform etc. - simply everything I was able to find across the Internet, but I am out of options and ideas.

What can I do to get this work?

1
@Ankita unfortunately no luck - still works for 7.1 and not for 8.0.otis_d

1 Answers

0
votes

use this line

    <?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
    <font
        android:fontStyle="normal"
        android:fontWeight="400"
        android:font="@font/lobster_regular" />
    <font
        android:fontStyle="italic"
        android:fontWeight="400"
        android:font="@font/lobster_italic" />
</font-family>

Read this line properly all details in this link