Simply using allowFontScaling={false}
fixes this on iOS, but I'm unsure how to set this on Android.
Also, for anyone that's not familiar with RN and is coming here from the Android tag, I don't think I can easily change from to dp
font scaling or whatever, so is there a way I can do it globally in my app somehow?
Thanks!
How do I prevent Android device Display size scaling in my app? Change the system display size programatically Android N. Disabling an app or activity zoom if Setting -> Display -> Display size changed to Large or small.
Prevent-system-font-size-changing-effects-to-androidForms Android MainActivity. cs, override the Resources and set the configuration to default to restrict the font size effect on application. Resources. UpdateConfiguration() has been deprecated in API 25.
1. Font scaling is an alternate term used to describe a scalable font or vector font. 2. Font scaling is a printer feature that allows the font to be scaled by the printer instead of in the document program.
Please Update ManiApplication.java file
import android.view.WindowManager;
import android.content.res.Configuration;
import android.content.Context;
import android.util.DisplayMetrics;
After super.onCreate();
method put adjustFontScale(getApplicationContext(),getResources().getConfiguration());
Like follow
@Override
public void onCreate() {
super.onCreate();
adjustFontScale(getApplicationContext(),getResources().getConfiguration());
}
And at the end add the following function
public void adjustFontScale(Context context, Configuration configuration) {
if (configuration.fontScale != 1) {
configuration.fontScale = 1;
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
wm.getDefaultDisplay().getMetrics(metrics);
metrics.scaledDensity = configuration.fontScale * metrics.density;
context.getResources().updateConfiguration(configuration, metrics);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With