当前位置:网站首页>webview报错
webview报错
2022-06-22 03:23:00 【一站到底s】
WebView.destroy() called while WebView is still attached to window.
解决方法:
现在总结下这个问题的解决办法。先大概解释下这个错误,这个错误从字面意思来说是当你结束webview的时候,Webview还依附在父控件下,使用解决这个问题
就是在WebView.destroy()前要解除他们之间的依附关系。一般会碰上这个问题应该是这样对webview进行了操作:
protected void onDestroy()
{
if (adView != null)
{
adView.destroy();
}
}
附上一段详细的正确代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webviewRelativeLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/headerAlarmsWebViewTxt"
android:layout_marginBottom="0dip"
android:hapticFeedbackEnabled="true"
android:overScrollMode="never"
android:scrollbarAlwaysDrawVerticalTrack="false"
android:scrollbars="none" />
</RelativeLayout>
Then you assign it to an instance variable e.g. :
_layout = (RelativeLayout) findViewById(R.id.webviewRelativeLayout);
webView = (WebView) findViewById(R.id.webView1);
and on Destroy do something like this:
@Override
protected void onDestroy() {
super.onDestroy();
_layout.removeView(webView);
webView.removeAllViews();
webView.destroy();
}
一般看了这段代码就能明白问题所在了。
转载地址:
(136条消息) Error: WebView.destroy() called while still attached 的解决办法_极客公园的博客-CSDN博客
边栏推荐
- [crawler notes 1] environment construction and necessary tools selenium
- Hosting environment, components, APIs, collaboration and publishing of applets
- 【NVMe2.0b 8】NVMe 队列仲裁机制
- On the auto increment of int type primary key in MySQL
- 3000元投影仪对比评测,当贝D3X完胜极米NEW Z6 X
- Nebula Graph学习篇2_版本v2.6.1之前的bug导致OOM
- [crawler notes 2] mouse events, screenshots and common attack methods
- 分析Iceberg合并任务解决数据冲突
- Rabbmitmq publishing keyword mode < 3 >
- 泛微 E-cology V9 信息泄露漏洞
猜你喜欢

3de 保存到收藏夹

3de 新建仿真状态

深度学习期末复习

Operating instructions for tcp202 current probe of Tektronix oscilloscope

Libuv asynchronous task logic and UV_ queue_ work()

Check information on the Internet after the college entrance examination, and pay attention to prevent websites without SSL certificates

AtCoder Regular Contest 142

php使用composer
![[crawler notes 2] mouse events, screenshots and common attack methods](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[crawler notes 2] mouse events, screenshots and common attack methods
![[网鼎杯 2018]Fakebook1 参考](/img/c8/a9d77308b6cc542c8c47a570b9234c.png)
[网鼎杯 2018]Fakebook1 参考
随机推荐
我们如何解决了RealSense偏色问题?
If you specify it as a gateway, does it become a gateway
[nvme2.0b 10] controller shutdown and NVM subsystem shutdown
76. 最小覆盖子串-滑动窗口法
618来袭,当贝X3和极米H3S怎么选?带你全方位深度解析
如何高效的读写文件思考
rabbmitMQ 发布关键字模式<三>
【NVMe2.0b 11】NVMe Reset
vim常用命令
torch. Max() explanation
[nvme2.0b 6] nvme queue model
Factory mode
PHP uses composer
fastdfs5.0.11安装
Nebula Graph学习篇2_版本v2.6.1之前的bug导致OOM
Typora + picgo configure the drawing bed to realize automatic uploading of pictures
AtCoder Regular Contest 142
Rabbmitmq simple mode < 1 >
Are you a technology manager or a project manager?
【Kubernetes 系列】Kubernetes 是什么?