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

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

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

WebView.setWebChromeClient介绍

暂无

代码示例

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

@Override
public WebListenerManager setWebChromeClient(WebView webview, WebChromeClient webChromeClient) {
  webview.setWebChromeClient(webChromeClient);
  return this;
}

代码示例来源: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: lshAndroid/WebviewTBS

webView.setWebChromeClient(new WebChromeClient() {
  @Override
  public void onProgressChanged(WebView view, int newProgress) {

代码示例来源: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

mWebView.setWebChromeClient(new MyWebChromeClient());
mWebView.loadUrl(mUrl);

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

mWebView.setWebChromeClient(new WebChromeClient(){
  @Override
  public void onProgressChanged(WebView view, int newProgress) {

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

webview.setWebChromeClient(new WebChromeClient() {
  @Override
  public void onProgressChanged(WebView view, int newProgress) {

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

webview.setWebChromeClient(new WebChromeClient() {
  @Override
  public void onProgressChanged(WebView view, int newProgress) {

相关文章