1. Enable setTextZoom function of Android-WebViewSetting

This commit is contained in:
YouCii 2019-04-19 15:36:12 +08:00
parent f3f0876f28
commit 944caa9d4f
2 changed files with 6 additions and 6 deletions

View File

@ -181,12 +181,7 @@ public class InAppWebView extends WebView {
settings.setUseWideViewPort(options.useWideViewPort);
settings.setSupportZoom(options.supportZoom);
// fix webview scaling
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
else
settings.setTextZoom(100);
settings.setTextZoom(options.textZoom);
}
public void loadUrl(String url, MethodChannel.Result result) {
@ -337,6 +332,9 @@ public class InAppWebView extends WebView {
if (newOptionsMap.get("supportZoom") != null && options.supportZoom != newOptions.supportZoom)
settings.setSupportZoom(newOptions.supportZoom);
if (newOptionsMap.get("textZoom") != null && options.textZoom != newOptions.textZoom)
settings.setTextZoom(newOptions.textZoom);
options = newOptions;
}

View File

@ -21,4 +21,6 @@ public class InAppWebViewOptions extends Options {
public boolean domStorageEnabled = false;
public boolean useWideViewPort = true;
public boolean safeBrowsingEnabled = true;
public int textZoom = 100;
}