简体   繁体   中英

Android 4.4 WebView Zoom centered

Zoom in with the WebView (on Android < 4.4.x) rearranged / relayout the content to be inside the border of the WebView. But with Android 4.4.x the zoom does not rearranged / relayout the content and just zoomed into the center of the loaded website.

在此输入图像描述

Does anyone can reproduce this issue? If yes: is there any workaround for this? I need the content (mostly just text) to be inside of the WebView without scrollbars horizontal.

EDIT: the pictures are AFTER zooming.

Have you tried ?

WebSettings settings = webView.getSettings();
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);

I have the same problem. I found that if you call to:

 webview.setInitialScale(webview.getScale()*100);

It cause the text to rearrange, just like we want. The problem is that after calling this function, it set the 'webview.getScale()' to be the base scaling of the text and it disables the zoom out (-) option (since this is now the minimum zoom level). This is the best thing I found so far.

Did you find any other better soultion?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM