com.tencent.smtt.sdk.WebView.setWebViewClient()方法的使用及代码示例

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

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

WebView.setWebViewClient介绍

暂无

代码示例

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

@Override
public WebListenerManager setWebViewClient(WebView webView, WebViewClient webViewClient) {
  webView.setWebViewClient(webViewClient);
  return this;
}

代码示例来源:origin: CN-ZPH/Three360panorama

@SuppressLint("SetJavaScriptEnabled")
  private void initView() {
    tencent_webview = (WebView) findViewById(R.id.web);
    tencent_webview.loadUrl(url);
    WebSettings webSettings = tencent_webview.getSettings();
    webSettings.setJavaScriptEnabled(true);
    tencent_webview.setWebViewClient(new WebViewClient() {
      @Override
      public boolean shouldOverrideUrlLoading(WebView view, String url) {
        return true;
      }
    });
  }
}

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

public 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: gaolhjy/enjoyshop

private void initData() {
  final WebSettings webSettings = mWebView.getSettings();
  webSettings.setJavaScriptEnabled(true);
  webSettings.setBlockNetworkImage(false);
  webSettings.setAppCacheEnabled(true);
  mWebView.loadUrl(HttpContants.WARES_DETAIL);
  mAppInterfce = new WebAppInterface(this);
  mWebView.addJavascriptInterface(mAppInterfce, "appInterface");
  mWebView.setWebViewClient(new WebViewClient() {
    @Override
    public boolean shouldOverrideUrlLoading(WebView webView, String s) {
      webView.loadUrl(s);
      return true;
    }
    @Override
    public void onPageFinished(WebView webView, String s) {
      super.onPageFinished(webView, s);
      //整个页面加载完后,才能调用这个方法
      mAppInterfce.showDetail();
    }
  });
}

代码示例来源:origin: lshAndroid/WebviewTBS

webSettings.setJavaScriptEnabled(true);
webView.loadUrl(url);
webView.setWebViewClient(new WebViewClient() {
  @Override
  public boolean shouldOverrideUrlLoading(WebView view, String url) {

代码示例来源:origin: leftcoding/GankLy

@SuppressLint("SetJavaScriptEnabled")
@Override
protected void initViews() {
  mWebView = new WebView(this, null);
  mViewParent.addView(mWebView, new FrameLayout.LayoutParams(
      FrameLayout.LayoutParams.MATCH_PARENT,
      FrameLayout.LayoutParams.MATCH_PARENT));
  WebSettings settings = mWebView.getSettings();
  mWebView.requestFocusFromTouch(); //支持获取手势焦点,输入用户名、密码或其他
  settings.setJavaScriptEnabled(true);  //支持js
  settings.setDomStorageEnabled(true); //
  settings.setSupportZoom(true); //设置支持缩放
  settings.setBuiltInZoomControls(true); //
  settings.setDisplayZoomControls(false);//是否显示缩放控件
  settings.setUseWideViewPort(true);  //将图片调整到适合webview的大小
  settings.setLoadWithOverviewMode(true); // 缩放至屏幕的大小
  settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); //支持内容重新布局
  settings.supportMultipleWindows();  //多窗口
  settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);  //关闭webview中缓存
  settings.setAllowFileAccess(true);  //设置可以访问文件
  settings.setNeedInitialFocus(true); //当webview调用requestFocus时为webview设置节点
  settings.setJavaScriptCanOpenWindowsAutomatically(true); //支持通过JS打开新窗口
  settings.setLoadsImagesAutomatically(true);  //支持自动加载图片
  settings.setDefaultTextEncodingName("utf-8");//设置编码格式
  mWebView.setWebViewClient(new MyWebViewClient());
  mWebView.setWebChromeClient(new MyWebChromeClient());
}

代码示例来源:origin: leftcoding/GankLy

settings.setPluginState(WebSettings.PluginState.ON_DEMAND);
mWebView.setWebViewClient(new MyWebViewClient());
mWebView.setWebChromeClient(new MyWebChromeClient());
mWebView.loadUrl(mUrl);

代码示例来源:origin: dom4j1/Red

mWebView.setWebViewClient(new WebViewClient() {
  @Override
  public boolean shouldOverrideUrlLoading(WebView view, String url) {

代码示例来源:origin: dom4j1/Red

mWebView.setWebViewClient(new WebViewClient() {
  @Override
  public boolean shouldOverrideUrlLoading(WebView view, String url) {

代码示例来源:origin: lionoggo/Akit-Reader

webview.setWebViewClient(new WebViewClient() {

代码示例来源:origin: lionoggo/FastApp

webview.setWebViewClient(new WebViewClient() {

相关文章