如何清除WebView内容? [英] How to clear WebView content?
本文介绍了如何清除WebView内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用程序中有一个WebView
,其宽度和高度为wrap_content
I have a WebView
in my app with wrap_content
width and height
在使用webview.loadData
之前,它的宽度和高度为0,在加载页面(或使用webview.loadData
)之后,它将显示一个网页.
Before I use webview.loadData
, the width and height of the it was 0, after I load a page (or I use webview.loadData
) , it'll display a web page.
我的问题是,如何像以前一样清除Webview使其恢复到原始状态?
My question is , how can I clear the webview to recover it back to the original state, just as before it loadData
?
推荐答案
I found this answer, pretty helpful: How do I clear a WebView's content before loading a page?
这是可可粉,但基本上只是打电话:
It is for Cocoa, but basically just call:
webView.loadUrl("about:blank")
这篇关于如何清除WebView内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文