android.webkit.WebView.removeAllViews()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(420)

本文整理了Java中android.webkit.WebView.removeAllViews()方法的一些代码示例,展示了WebView.removeAllViews()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.removeAllViews()方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:removeAllViews

WebView.removeAllViews介绍

暂无

代码示例

代码示例来源:origin: jaydenxiao2016/AndroidFire

@Override
protected void onDestroy() {
  if(webView!=null) {
    webView.removeAllViews();
    webView.destroy();
  }
  super.onDestroy();
}

代码示例来源:origin: Justson/AgentWeb

static final void clearWebView(WebView m) {
  if (m == null) {
    return;
  }
  if (Looper.myLooper() != Looper.getMainLooper()) {
    return;
  }
  m.loadUrl("about:blank");
  m.stopLoading();
  if (m.getHandler() != null) {
    m.getHandler().removeCallbacksAndMessages(null);
  }
  m.removeAllViews();
  ViewGroup mViewGroup = null;
  if ((mViewGroup = ((ViewGroup) m.getParent())) != null) {
    mViewGroup.removeView(m);
  }
  m.setWebChromeClient(null);
  m.setWebViewClient(null);
  m.setTag(null);
  m.clearHistory();
  m.destroy();
  m = null;
}

代码示例来源:origin: kaku2015/ColorfulNews

@Override
  protected void onDestroy() {
    super.onDestroy();
    mWebView.removeAllViews();
    mWebView.destroy();
  }
}

代码示例来源:origin: limedroid/XDroidMvp

@Override
protected void onDestroy() {
  super.onDestroy();
  if (webView != null) {
    ViewGroup parent = (ViewGroup) webView.getParent();
    if (parent != null) {
      parent.removeView(webView);
    }
    webView.removeAllViews();
    webView.destroy();
  }
}

代码示例来源:origin: limedroid/XDroid

@Override
protected void onDestroy() {
  super.onDestroy();
  if (webView != null) {
    ViewGroup parent = (ViewGroup) webView.getParent();
    if (parent != null) {
      parent.removeView(webView);
    }
    webView.removeAllViews();
    webView.destroy();
  }
}

代码示例来源:origin: iTXTech/Daedalus

@Override
  public void onDestroyView() {
    super.onDestroyView();

    if (mWebView != null) {
      Log.d("DAboutActivity", "onDestroy");

      mWebView.removeAllViews();
      mWebView.setWebViewClient(null);
      ((ViewGroup) mWebView.getParent()).removeView(mWebView);
      mWebView.setTag(null);
      mWebView.clearHistory();
      mWebView.destroy();
      mWebView = null;
    }
  }
}

代码示例来源:origin: weexteam/weex-hackernews

@Override
public void destroy() {
  if (getWebView() != null) {
    getWebView().removeAllViews();
    getWebView().destroy();
    mWebView = null;
  }
}

代码示例来源:origin: jethroMu/FunProj

@Override
protected void onDestroy() {
  if (mWebView != null) {
    mWebView.removeAllViews();
  }
  super.onDestroy();
}

代码示例来源:origin: indywidualny/FaceSlim

@Override
public void onDestroy() {
  Log.i(TAG, "onDestroy: Destroying...");
  super.onDestroy();
  if (webView != null) {
    webView.removeAllViews();
    webView.destroy();
    webView = null;
  }
  // just in case, it should be GCed anyway
  if (mWebChromeClient != null)
    mWebChromeClient = null;
}

代码示例来源:origin: zhangke3016/GeneratePicture

/**
 * 加载页面
 * @param v
 */
public void Load(View v){
  pd.show();
  webView.removeAllViews();
  edt.clearFocus();
  webView.loadUrl(edt.getText().toString().trim());
}

代码示例来源:origin: gaolonglong/GankGirl

@Override
  protected void onDestroy() {
    super.onDestroy();
    if (webView != null){
      webView.removeAllViews();
      webView.destroy();
    }
  }
}

代码示例来源:origin: listenzz/AndroidNavigation

@Override
public void onDestroyView() {
  super.onDestroyView();
  try {
    if (webView != null) {
      webView.removeAllViews();
      webView.destroy();
      webView = null;
    }
  } catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: hefuyicoder/ZhihuDaily

@Override
public void onDestroy() {
  super.onDestroy();
  if (isWebViewOK()) {
    mWebViewSoftReference.get().removeAllViews();
    mWebViewSoftReference.get().destroy();
    llWebViewContainer.removeView(mWebViewSoftReference.get());
    mWebViewSoftReference = null;
  }
}

代码示例来源:origin: Leaking/WeGit

@Override
  protected void onDestroy() {
    super.onDestroy();
    webview.removeAllViews();
    webview.destroy();
  }
}

代码示例来源:origin: w0080626/GankIO

@Override
  protected void onDestroy() {
    super.onDestroy();
    if (webView != null) {
      webView.removeAllViews();
      webView.destroy();
    }
  }
}

代码示例来源:origin: 8enet/AppOpsX

@Override
 protected void onDestroy() {
  try {
   ((ViewGroup) webView.getParent()).removeView(webView);
   webView.removeAllViews();
   webView.destroy();
  } catch (Exception e) {
   e.printStackTrace();
  }
  super.onDestroy();
 }
}

代码示例来源:origin: zhangke3016/GeneratePicture

@Override
protected void onDestroy() {
  super.onDestroy();
  WebViewHelper.getInstance().clear();
  webView.removeAllViews();
  webView.setVisibility(View.GONE);
  webView = null;
}

代码示例来源:origin: 736008081/frameAndroid

@Override
  protected void onDestroy() {
    super.onDestroy();
    if (mWebView != null) {
      ((ViewGroup) mWebView.getParent()).removeView(mWebView);
      mWebView.removeAllViews();
      mWebView.destroy();
    }
  }
}

代码示例来源:origin: Wensibob/GankClient

@Override
    protected void onDestroy() {
        super.onDestroy();
        if (webView != null) {
            webView.removeView(webView);
            webView.removeAllViews();
            webView.destroy();
            webView = null;
        }
        presenter.release();
    }
}

代码示例来源:origin: hezhubo/HPlayer

@Override
public void onDestroy() {
  mWebView.stopLoading();
  mWebView.destroyDrawingCache();
  mWebView.removeAllViews();
  mWebView.setVisibility(View.GONE);
  mWebView.destroy();
  super.onDestroy();
}

相关文章

WebView类方法