Last active
January 7, 2020 11:32
-
-
Save simonemarra/0e21c2ee7061959c886ec8a62ee06fa6 to your computer and use it in GitHub Desktop.
Xamarin Android: lock font scale accessibility to default value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// source: https://forums.xamarin.com/discussion/81842/prevent-change-font-size | |
// Add this code to MainActivity.cs class to force FontScaling to default (1.0) value: | |
protected override void AttachBaseContext(Context @base) | |
{ | |
var configuration = new Configuration(@base.Resources.Configuration); | |
//0.85 small, 1 standard, 1.15 big,1.3 more bigger ,1.45 super big | |
configuration.FontScale = 1f; | |
var config = Application.Context.CreateConfigurationContext(configuration); | |
base.AttachBaseContext(config); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment