Steven
November 10, 2020, 10:57am
1
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.
Steven
November 10, 2020, 12:46pm
4
.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.
Steven
November 10, 2020, 4:33pm
7
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.
Steven
November 10, 2020, 5:50pm
9
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
Steven
November 10, 2020, 5:55pm
10
BTW i realized that the text size setting in the iOS settings has no effect on the text size in the app.
1 Like