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

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

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

WebView.getSettings介绍

暂无

代码示例

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

private void loadWebvieUrl(String url) {
  progressBar = (ProgressBar) findViewById(R.id.progressBar);
  webView = (com.tencent.smtt.sdk.WebView) findViewById(R.id.webview_wechat);
  WebSettings webSettings = webView.getSettings();
  webSettings.setJavaScriptEnabled(true);
  webView.loadUrl(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

FrameLayout.LayoutParams.MATCH_PARENT));
WebSettings settings = mWebView.getSettings();

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

WebSettings webSetting = mWebView.getSettings();
webSetting.setBlockNetworkImage(false); //允许WebView从网络上加载图片
webSetting.setAppCacheEnabled(true); //启用应用缓存

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

String url = intent.getStringExtra(Constants.URL);
WebSettings webSetting = mWebView.getSettings();
webSetting.setBlockNetworkImage(false); //允许WebView从网络上加载图片
webSetting.setAppCacheEnabled(true); //启用应用缓存

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

@Override
public void initView(View view) {
  WebSettings settings = webview.getSettings();
  settings.setJavaScriptEnabled(true);
  settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);

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

@Override
public void initView(View view) {
  WebSettings settings = webview.getSettings();
  settings.setJavaScriptEnabled(true);
  settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);

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

this.mWebSettings = webView.getSettings();

相关文章