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

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

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

WebView.setBackgroundColor介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

WebView myWebView = (WebView) findViewById(R.id.myWebView);
myWebView.setBackgroundColor(Color.parseColor("#000000"));
myWebView.getSettings.setDefaultFontSize(10);

代码示例来源:origin: stackoverflow.com

WebView myWebView = (WebView) findViewById(R.id.myWebView);
myWebView.setBackgroundColor(Color.parseColor("#123456"));

代码示例来源:origin: stackoverflow.com

WebView synopsis;
synopsis=(WebView)findViewById(R.id.synopsis);
synopsis.getSettings();
synopsis.setBackgroundColor(Color.TRANSPARENT);

代码示例来源:origin: hidroh/materialistic

@Override
  public void onProgressChanged(WebView view, int newProgress) {
    super.onProgressChanged(view, newProgress);
    progressBar.setVisibility(View.VISIBLE);
    progressBar.setProgress(newProgress);
    if (newProgress == 100) {
      progressBar.setVisibility(View.GONE);
      webView.setBackgroundColor(Color.WHITE);
      webView.setVisibility(View.VISIBLE);
    }
  }
});

代码示例来源:origin: androidquery/androidquery

private void setup(){
  
  String source = getSource(wv.getContext());
  String html = source.replace("@src", url).replace("@color", Integer.toHexString(color));
  
  wv.setWebViewClient(this);
  
  //wv.setInitialScale(100);
  wv.loadDataWithBaseURL(null, html, "text/html", "utf-8", null);
  wv.setBackgroundColor(color);
  
}

代码示例来源:origin: androidquery/androidquery

private void delaySetup(){
  
  wv.setPictureListener(new PictureListener() {
    
    @Override
    public void onNewPicture(WebView view, Picture picture) {
      wv.setPictureListener(null);
      setup();
    }
    
    
  });
  
  //wv.setInitialScale(100);
  wv.loadData("<html></html>", "text/html", "utf-8");
  wv.setBackgroundColor(color);
  
}

代码示例来源:origin: ankidroid/Anki-Android

@Override
  protected void onPostExecute(String html) {
    if (html != null && mIsRunning) {
      try {
        mWebView.loadData(URLEncoder.encode(html, "UTF-8").replaceAll("\\+", " "), "text/html; charset=utf-8", "utf-8");
      } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
      }
      mProgressBar.setVisibility(View.GONE);
      int backgroundColor = Themes.getColorFromAttr(mWebView.getContext(), android.R.attr.colorBackground);
      mWebView.setBackgroundColor(backgroundColor);
      mWebView.setVisibility(View.VISIBLE);
      mWebView.invalidate();
    }
  }
}

代码示例来源:origin: ankidroid/Anki-Android

webView.setBackgroundColor(typedValue.data);
getTheme().resolveAttribute(android.R.attr.textColor, typedValue, true);
String textColor = String.format("#%06X", (0xFFFFFF & typedValue.data)); // Color to hex string

代码示例来源:origin: ankidroid/Anki-Android

webView.setBackgroundColor(Color.argb(1, 0, 0, 0));
return webView;

代码示例来源:origin: androidquery/androidquery

wv.setBackgroundColor(color);

代码示例来源:origin: hidroh/materialistic

final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress);
final WebView webView = (WebView) findViewById(R.id.web_view);
webView.setBackgroundColor(Color.TRANSPARENT);
webView.setWebViewClient(new AdBlockWebViewClient(Preferences.adBlockEnabled(this)) {
  @Override

代码示例来源:origin: ankidroid/Anki-Android

Timber.d("mChart is not null!");
mWebView.setBackgroundColor(Color.argb(1, 0, 0, 0));

代码示例来源:origin: stackoverflow.com

WebView webview = (WebView)findViewById(R.id.webView1);        
webview.setBackgroundColor(0);

代码示例来源:origin: stackoverflow.com

WebView myWebView = (WebView) findViewById(R.id.myWebView);
myWebView.setBackgroundColor(Color.parseColor("#000000"));

代码示例来源:origin: stackoverflow.com

WebView webView = new WebView(this);
webView.setBackgroundColor(0xff000000);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setSupportZoom(true);
//webView.getSettings().setDisplayZoomControls(false);  // API 11
webView.loadDataWithBaseURL(null, getHtml(), "text/html", "UTF-8", null);
mainView.addView(webView, -1, -2);

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

mWebView.setBackgroundColor(0);
mWebView.addJavascriptInterface(this, "JavascriptInterface");

代码示例来源:origin: stackoverflow.com

WebView view = new WebView(this);
   view.getSettings().setJavaScriptEnabled(true);
   view.loadUrl("file:///android_asset/**YOUR FILE NAME**.html");
   view.setBackgroundColor(Color.TRANSPARENT);
   setContentView(view);

代码示例来源:origin: stackoverflow.com

WebView wv;  
 wv = (WebView) findViewById(R.id.webView1);  
 wv.setBackgroundColor(0);
 wv.setBackgroundResource(android.R.color.black);
 wv.setWebChromeClient(new WebChromeClient());
 wv.setWebViewClient(new WebViewClient());
 wv.getSettings().setJavaScriptEnabled(true);
 wv.getSettings().setPluginsEnabled(true);
 wv.loadUrl("file:///android_asset/Index_Animation/test.html");

代码示例来源:origin: msdx/status-bar-compat

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  webView = new WebView(this);
  webView.setBackgroundColor(Color.CYAN);
  webView.loadUrl("http://www.githang.com");
  setContentView(webView);
  StatusBarCompat.setStatusBarColor(this, Color.BLUE);
}

代码示例来源:origin: stackoverflow.com

String LocalFile = "file:///android_asset/YOUR_HTML_FILE.htm";
 WebView webView = (WebView) findViewById(R.id.YOUR_WEB_VIEW);
 WebSettings webSettings = webView.getSettings();
 webSettings.setJavaScriptEnabled(true);
 webSettings.setPluginsEnabled(true);
 webSettings.setLoadWithOverviewMode(true);
 webSettings.setUseWideViewPort(true); 
 webSettings.setAllowFileAccess(true);
 webView.setBackgroundColor(Color.BLACK);
 webView.setVerticalScrollBarEnabled(false);
 webView.setHorizontalScrollBarEnabled(false);
 webView.loadUrl(LocalFile);

相关文章

微信公众号

最新文章

更多

WebView类方法