Skip to content

Instantly share code, notes, and snippets.

@simonemarra
Last active January 7, 2020 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonemarra/0e21c2ee7061959c886ec8a62ee06fa6 to your computer and use it in GitHub Desktop.
Save simonemarra/0e21c2ee7061959c886ec8a62ee06fa6 to your computer and use it in GitHub Desktop.
Xamarin Android: lock font scale accessibility to default value
// 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