Reputation: 14400
i have webview
loaded with custom htlm string
my problem is when i set my phone text size as largest the webview
text still as normal or small
i found solution
to set webview
text size but its fixed
is there any way to make webview
text
size
as system default text size ?
this is my webview setting
holder.message.getSettings().setTextSize(WebSettings.TextSize.NORMAL);
Upvotes: 2
Views: 3540
Reputation: 41
I got this to work:
WebView webview = result.findViewById(R.id.webview);
WebSettings settings = webview.getSettings();
float scale = 100f*getResources().getConfiguration().fontScale;
settings.setTextZoom((int)scale);
webview.loadUrl("file:///android_asset/file.html");
It gets the scale from the system configuration, then uses that to set the zoom factor. In my HTML I added < font size="4" > to make it just a little bigger.
Upvotes: 3