保持webView页面已加载?

时间:2015-03-31 22:12:32

标签: android android-layout android-fragments android-activity webview

我创建了一个浏览器,其中包含一个用于打开新标签的按钮。当我点击它时,它会返回到之前的webview活动。问题是,当我反印时,我不希望它再次重新加载页面。屏幕旋转时也会发生同样的事情。有没有具体的功能呢?感谢。

1 个答案:

答案 0 :(得分:0)

将WebView的onPageStarted方法覆盖为

@Override
   public void onPageStarted(WebView view, String url, Bitmap favicon)
   {
    super.onPageStarted(view, url, favicon);
    String htmlContent = getRemoteContent(url);
    webview.loadDataWithBaseURL(url, htmlContent, null, "utf-8", url);
   }