Android font size gets overridden by native Android settings

ShannonHaas.5932ShannonHaas.5932 USUniversity ✭✭
edited September 2015 in Xamarin.Forms

I am setting my font size using the NamedSize enumeration. In iOS the font displays as the set size regardless of the font size set in the os settings. This however is not the case for Android. If I set my NamedSize to medium and the Android settings have font size set to large, the font will be large. Even when I set it to an int value, the Android overrides it with the font size from settings which in turn makes the app look terrible in some situations. Does anyone have a way to have the font size not get overridden by the Android native settings?

Best Answer

Answers

  • adamkempadamkemp USInsider, Developer Group Leader mod

    There are two different cases here: the named sizes and the number sizes. As described in this thread, I believe the behavior on Android for numeric sizes is wrong. I don't think they should change with the accessibility settings. I think that's a bug.

    However, what you just described as the behavior for named sizes on Android sounds correct to me. Named sizes should change according to accessibility rules, and that is the point of using them. If they don't do that on iOS then that is a bug.

    It's definitely unfortunate that they are inconsistent between the platforms.

  • ShannonHaas.5932ShannonHaas.5932 USUniversity ✭✭

    I do agree on one hand that the font should change according to the accessibility setting... but as a developer, it is not easy to deal with. As you suggested, I agree that it is a bug that the dp value should not be overridden... otherwise what is the purpose of being able to set the size.
    I am currently setting the Android dp font size low enough to accommodate both Medium and Large accessibility setting, but out of luck with XL. @adamkemp Are you aware of a bug report on this? I could not find one. Thanks for the help.

  • ShannonHaas.5932ShannonHaas.5932 USUniversity ✭✭

    I created a bug report.
    https://bugzilla.xamarin.com/show_bug.cgi?id=33579

    Thanks for the help @adamkemp . And you are correct, That's why we get paid!!!

  • CraigDunnCraigDunn USXamarin Team Xamurai

    I'm realizing we need to communicate this better in the docs, but for Xamarin.Forms apps in iOS to obey the accessibility settings, use the DynamicResource binding to a built-in Style (from the styles doc).

    I can't recall ottomh the Android behavior, will check it out tmr... but it does sound strange the the behavior varies across platforms.

    I think NamedSize is just an alias for a double on each platform, so I'd expect the same behavior (wrt Accessibility) for both NamedSize and a specific numeric size. Only using a built-in Style would I expect the accessbility stuff to affect the size.

  • NMackayNMackay GBInsider, University mod
    edited November 2015

    .

  • Loki606Loki606 Member ✭✭

    This is an old thread, but as far as I've seen in Android API 28 there is no current way of overriding the FontScale and FontFamily from the phone settings. Apps like Instagram and Facebook are all affected when I change the setting on my device and I assume they know what they're doing.

Sign In or Register to comment.