Android WebView 缩小受限

Android WebView Zoom out limited

我在 Android 中使用 WebView。加载网页后,我想使用屏幕缩小控件。单击一两次后,它变为灰色,不再允许我进一步缩小。当我在代码中调用 zoomOut() 函数时,它也不会进一步缩小。

是什么限制了我可以缩小多少。我希望能够缩小到比我允许的范围更远的程度 - 以至于页面太小而无法阅读。但是,在我达到此缩放级别之前,缩小功能已被禁用。

非常感谢任何帮助。

谢谢,
巴里。


你应该这样做 myWebView.getSettings().setUseWideViewPort(true)

然后你会发现你可以缩小到比你通常在默认设置下看到的更远。


看看 WebView.setInitialScale(...) - 我不确定它是否会帮助你实现你想要的,但是将它设置为 50,例如,会将 WebView 缩放到它的 50%正常尺寸。我认为这将允许您放大然后再次缩小到(初始)较小的尺寸。


Hey Barry
The built in range for that zoomin and zoomout function is starts from 0.8 something that is the minimum value after this if you
will call the zoomout function it will return the false value and
maximum value for zoomin is upto 4.0 ,So these zoomin and zoomout
functions are of boolean type Like for a zoomin function wverytime you
call zoomin function it multiply with some factor and return true if
further zoomin is possible and whenever it reaches to the last point
that is 4.0 so it will return false and after that it will not zoom
in.