Issue
The problem is when i adjusted the android device system font-size, my
user application’s font-sizes are changing to device system font-size
how to prevent it
Solution
The default unit for font size in Android is Scaled Pixels, setting it to DIP or PX will prevent auto scaling.
Tested against v6.0
import { isAndroid } from 'tns-core-modules/platform';
import { TextBase } from 'tns-core-modules/ui/text-base/text-base';
declare var android; // required if tns-platform-declarations is not installed
if (isAndroid) {
TextBase.prototype[require("tns-core-modules/ui/text-base/text-base-common").fontSizeProperty.setNative] = function (value) {
if (!this.formattedText || (typeof value !== "number")) {
if (typeof value === "number") {
this.nativeTextViewProtected.setTextSize(android.util.TypedValue.COMPLEX_UNIT_DIP, value);
}
else {
this.nativeTextViewProtected.setTextSize(android.util.TypedValue.COMPLEX_UNIT_PX, value.nativeSize);
}
}
};
}
Since you are using Angular, you may place this code in main.ts
Or in app module.
Answered By – Manoj
Answer Checked By – Candace Johnson (AngularFixing Volunteer)