如何清除WebView内容?

编程入门 行业动态 更新时间:2024-10-23 16:17:13
本文介绍了如何清除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?

推荐答案

我找到了这个答案,非常有帮助:如何在加载页面之前清除WebView的内容?

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内容?

本文发布于:2023-11-03 16:23:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555569.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:内容   WebView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!