How to set a fixed font-size?

Hey!
When i set the font size in my Android phone settings to normal, my cordova app use 14px font-size and everything looks fine. When i setup a bigger font size in my phone settings, all icons, buttons etc. messed up. Is there a way to set the font-size fixed to 14px?

body{font-size:14px!important} //does not work

Thank you!

I think you can’t.
You can change css rules to button to adapt text.

The following workaround works for me:
In MainActivity.Java:

import android.webkit.WebView;
import android.webkit.WebSettings;
...
//After loadUrl();
WebView webView = (WebView)appView.getEngine().getView();
WebSettings settings = webView.getSettings();
settings.setTextSize(WebSettings.TextSize.NORMAL);

In this way, the size of the fonts is kept fixed regardless of the user’s OS configuration.

.button{font-size:14px!important} //does not work

@fabricio
Thanks, works great! Do you have also a solution for iOS?

Great!

For iOS I haven’t found a workaround yet. If you find it, let me know

Thats great, but users who use big font in his phone, can’t use the app.
ok,… Yes, they can use it, but it is not very friendly.

Better a normal font size as a font size where all button texts are cutted. Look at my second screenshot, it looks really bad.

Yes it’s bad, but you can make the button adapt the content.
Just another solution.

I did but there are many more things to change. For example the icon size on the tabbar or fab buttons. They are way to big. Also the text is to long at many points in the app:

1 Like

BTW i realized that the text size setting in the iOS settings has no effect on the text size in the app.

1 Like