在关闭WebView时,其他按钮失去功能的解决方法是在onDestroyView()方法中调用WebView的destroy()方法,以释放资源。示例代码如下:
@Override public void onDestroyView() { super.onDestroyView(); if (webView != null) { webView.loadDataWithBaseURL(null, "", "text/html", "utf-8", null); webView.clearHistory(); ((ViewGroup) webView.getParent()).removeView(webView); webView.destroy(); webView = null; } }
上一篇:AndroidStudio:Causedby:org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration导致的错误