Scalable FontSize in Xamarin forms [IOS, Android, UWP]

Hello folks, I'm relatively new with Xamarin forms, been using it for about a month now.
I'm trying to make an app that should look relatively the same on all phone and tablet resolutions.
I've googled around and from what I've found there doesn't seem to be support for scaling font scales to the resolution of the app.

So I've resorted to getting the resolution of the app and then scaling the fontSize accordingly with a bindingValue.
It works but I don't think it's the best way of doing this.

So, does anyone else have a good solution for this? I was recommended to checkout Android Support Library, but as the name says it's sadly only for Android.

Cheers!

Posts

  • MtiMti USMember ✭✭
    edited October 2017

    You can also use the NamedSize enumeration which has four built-in options; Xamarin.Forms chooses the best size for each platform.

    Micro
    Small
    Medium
    Large

    label.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label));

    or like this xaml

    <Label Text="Test" FontSize="Large"/>

  • LordDzLordDz SEMember

    Alright, I'll try experimenting a bit more with that.
    But are there any way to get Margins and padding to be relative to the screensize too?

Sign In or Register to comment.