Android 完全阻止 WebView 缩放
我有一个 WebView,并且有以下代码:
webview.setInitialScale(75);
我还禁用了缩放:
webview.getSettings().setSupportZoom(false);
这两段代码都工作得很好,直到在 WebView 中选择任何类型的文本框(输入字段),然后应用程序缩放到 100%。
我试图弄清楚如何在选择文本框时拦截并阻止比例发生,但是我对以下内容没有运气:
onCheckIsTextEditor()
- 单击文本框时这似乎不会触发
我可以页面缩放后,通过覆盖 onScaleChanged( )
WebViewClient 类中的方法。但是,这只能通过循环 zoomOut()
方法,直到达到适当的比例。
对我来说,似乎必须有一个位置,单击实际上会触发事件来聚焦文本框并重绘视图以缩放它(并且调用 onScaleChanged()
),我只是无法还没有找到它。
任何帮助将不胜感激。
I have a WebView, and I have the following code:
webview.setInitialScale(75);
I also have zooming disabled:
webview.getSettings().setSupportZoom(false);
Both of these pieces of code work very well until any sort of textbox (input field) is selected within the WebView, then the application scales to 100%.
I'm trying to figure out how to intercept and stop the scale from taking place when a textbox is selected, however I've had no luck with the following:
onCheckIsTextEditor()
- This doesn't seem to fire when the textbox is clicked
I can change the Scale back to 75% after the page scales by Overriding the onScaleChanged()
method within the WebViewClient class. However this can only be done by looping through with the zoomOut()
method until the proper scale is met.
To me it seems there must be a location where the click actually fires the event to focus the textbox and redraw the view to scale it (and onScaleChanged()
is called), I just haven't been able to locate it yet.
Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论