android.webkit.WebView#setBackgroundColor ( )源码实例Demo

下面列出了android.webkit.WebView#setBackgroundColor ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: weMessage   文件: IncomingMessageViewHolder.java
public IncomingMessageViewHolder(View itemView) {
    super(itemView);

    attachmentsContainer = itemView.findViewById(R.id.attachmentsContainer);
    senderName = itemView.findViewById(R.id.senderName);
    selectedBubble = itemView.findViewById(R.id.selectedMessageBubble);
    replayButton = itemView.findViewById(R.id.replayButton);

    WebView invisibleInkView = new WebView(getActivity());
    invisibleInkView.getSettings().setJavaScriptEnabled(true);
    invisibleInkView.setBackgroundColor(Color.TRANSPARENT);
    invisibleInkView.addJavascriptInterface(this, "weMessage");
    invisibleInkView.setVerticalScrollBarEnabled(false);
    invisibleInkView.setHorizontalScrollBarEnabled(false);

    bubble.addView(invisibleInkView);
    this.invisibleInkView = invisibleInkView;
}
 
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_mainhelp);

    TextView versionTextView = (TextView) findViewById(R.id.versionTextView);
    if (versionTextView != null) {
        versionTextView.setText("v" + BuildConfig.VERSION_NAME);
    }

    WebView infoWebView = (WebView) findViewById(R.id.infoWebView);
    if (infoWebView != null) {
        infoWebView.setBackgroundColor(Color.TRANSPARENT);
        infoWebView.loadUrl("file:///android_asset/help/app_help.html");
    }
}
 
源代码3 项目: xDrip-plus   文件: LicenseAgreementActivity.java
public void viewGoogleLicenses(View myview) {
    try {
        if (!appended) {
            final String googleLicense = GoogleApiAvailability.getInstance().getOpenSourceSoftwareLicenseInfo(getApplicationContext());
            if (googleLicense != null) {
                String whiteheader = "<font size=-2 color=white><pre>";
                String whitefooter = "</font></pre>";
                WebView textview = (WebView) findViewById(R.id.webView);
                textview.setBackgroundColor(Color.TRANSPARENT);
                textview.getSettings().setJavaScriptEnabled(false);
                textview.loadDataWithBaseURL("", whiteheader + googleLicense + whitefooter, "text/html", "UTF-8", "");
                appended = true;
                findViewById(R.id.googlelicenses).setVisibility(View.INVISIBLE);
                findViewById(R.id.webView).setVisibility(View.VISIBLE);

            } else {
                UserError.Log.d(TAG, "Nullpointer getting Google License: errorcode:" + GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getApplicationContext()));
                findViewById(R.id.googlelicenses).setVisibility(View.INVISIBLE);
            }
        }
    } catch (Exception e) {
        // meh
    }
}
 
源代码4 项目: Augendiagnose   文件: DisplayHtmlFragment.java
@Override
public final void onActivityCreated(final Bundle savedInstanceState) {
	super.onActivityCreated(savedInstanceState);
	if (getView() == null) {
		return;
	}

	WebView webView = getView().findViewById(R.id.webViewDisplayHtml);
	webView.setBackgroundColor(0x00000000);

	setOpenLinksInExternalBrowser(webView);

	String html = getString(mResource);
	if (mResource == R.string.html_release_notes_base) {
		int indexBody = html.indexOf("</body>");
		String releaseNotes =
				ReleaseNotesUtil.getReleaseNotesHtml(getActivity(), false, 1, Application.getVersion());
		html = html.substring(0, indexBody) + releaseNotes + html.substring(indexBody);
	}

	// add style
	int index = html.indexOf("</head>");
	html = html.substring(0, index) + STYLE + html.substring(index);

	webView.loadDataWithBaseURL("file:///android_res/drawable/", html, "text/html", "utf-8", "");
}
 
源代码5 项目: MuslimMateAndroid   文件: AboutActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);

    getSupportActionBar().setTitle(getString(R.string.about));
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    progressBar = (ProgressBar) findViewById(R.id.progress);
    progressBar.getIndeterminateDrawable()
            .setColorFilter(ContextCompat.getColor(this, R.color.colorPrimary), PorterDuff.Mode.SRC_IN);
    info_web = (WebView) findViewById(R.id.webview_company_info);
    info_web.setBackgroundColor(Color.TRANSPARENT);
    info_web.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    info_web.setWebViewClient(new myWebClient());
    info_web.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    info_web.getSettings().setJavaScriptEnabled(true);
    info_web.getSettings().setDefaultFontSize((int) getResources().getDimension(R.dimen.about_text_size));

    String infoText = getString(R.string.company_info_web);
    info_web.loadDataWithBaseURL("file:///android_asset/fonts/", getWebViewText(infoText), "text/html", "utf-8", null);

}
 
源代码6 项目: xDrip   文件: LicenseAgreementActivity.java
public void viewGoogleLicenses(View myview) {
    try {
        if (!appended) {
            final String googleLicense = GoogleApiAvailability.getInstance().getOpenSourceSoftwareLicenseInfo(getApplicationContext());
            if (googleLicense != null) {
                String whiteheader = "<font size=-2 color=white><pre>";
                String whitefooter = "</font></pre>";
                WebView textview = (WebView) findViewById(R.id.webView);
                textview.setBackgroundColor(Color.TRANSPARENT);
                textview.getSettings().setJavaScriptEnabled(false);
                textview.loadDataWithBaseURL("", whiteheader + googleLicense + whitefooter, "text/html", "UTF-8", "");
                appended = true;
                findViewById(R.id.googlelicenses).setVisibility(View.INVISIBLE);
                findViewById(R.id.webView).setVisibility(View.VISIBLE);

            } else {
                UserError.Log.d(TAG, "Nullpointer getting Google License: errorcode:" + GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getApplicationContext()));
                findViewById(R.id.googlelicenses).setVisibility(View.INVISIBLE);
            }
        }
    } catch (Exception e) {
        // meh
    }
}
 
源代码7 项目: android-discourse   文件: Utils.java
@SuppressLint("SetJavaScriptEnabled")
public static void displayArticle(WebView webView, Article article, Context context) {
    String styles = "iframe, img { width: 100%; }";
    if (isDarkTheme(context)) {
        webView.setBackgroundColor(Color.BLACK);
        styles += "body { background-color: #000000; color: #F6F6F6; } a { color: #0099FF; }";
    }
    String html = String.format("<html><head><meta charset=\"utf-8\"><link rel=\"stylesheet\" type=\"text/css\" href=\"http://cdn.uservoice.com/stylesheets/vendor/typeset.css\"/><style>%s</style></head><body class=\"typeset\" style=\"font-family: sans-serif; margin: 1em\"><h3>%s</h3>%s</body></html>", styles, article.getTitle(), article.getHtml());
    webView.setWebChromeClient(new WebChromeClient());
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setPluginState(PluginState.ON);
    webView.loadUrl(String.format("data:text/html;charset=utf-8,%s", Uri.encode(html)));
}
 
源代码8 项目: SimplicityBrowser   文件: MainActivity.java
@Override
public void onProgressChanged(WebView view, int progress) {
    mProgress.setProgress(progress);
    if (progress < 100) {
        mProgress.setVisibility(View.VISIBLE);
    } else {
        mProgress.setVisibility(GONE);
    }
    if (UserPreferences.getBoolean("dark_mode_web", false) && view != null) {
        CSSInjection.injectDarkMode(SimplicityApplication.getContextOfApplication(), view);
        view.setBackgroundColor(Color.parseColor("#202020"));
    }
    super.onProgressChanged(view, progress);
}
 
源代码9 项目: uservoice-android-sdk   文件: Utils.java
@SuppressLint("SetJavaScriptEnabled")
public static void displayArticle(WebView webView, Article article, Context context) {
    String styles = "iframe, img { max-width: 100%; }";
    if (isDarkTheme(context)) {
        webView.setBackgroundColor(Color.parseColor("#303030"));
        styles += "body { background-color: #303030; color: #F6F6F6; } a { color: #0099FF; }";
    }
    String html = String.format("<html><head><meta charset=\"utf-8\"><link rel=\"stylesheet\" type=\"text/css\" href=\"http://cdn.uservoice.com/stylesheets/vendor/typeset.css\"/><style>%s</style></head><body class=\"typeset\" style=\"font-family: sans-serif; margin: 1em\"><h3>%s</h3><br>%s</body></html>", styles, article.getTitle(), article.getHtml());
    webView.setWebChromeClient(new WebChromeClient());
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setPluginState(PluginState.ON);
    webView.loadUrl(String.format("data:text/html;charset=utf-8,%s", Uri.encode(html)));
}
 
源代码10 项目: 4pdaClient-plus   文件: EmoticsQuickView.java
@Override
View createView() {
    if (getContext() == null)
        return new View(getContext());
    LayoutInflater inflater = LayoutInflater.from(getContext());
    webView = new WebView(inflater.getContext());
    webView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    webView.setBackgroundColor(AppTheme.getThemeStyleWebViewBackground());
    loadWebView();
    return webView;
}
 
源代码11 项目: UpdogFarmer   文件: AboutDialog.java
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final WebView webView = (WebView) LayoutInflater.from(getActivity()).inflate(R.layout.about_dialog, null);
    final String lang = Locale.getDefault().getLanguage();
    String uri = "file:///android_asset/about.html";
    try {
        // Load language-specific version of the about page if available.
        final List<String> assets = Arrays.asList(getResources().getAssets().list(""));
        if (assets.contains(String.format("about-%s.html", lang))) {
            uri = String.format("file:///android_asset/about-%s.html", lang);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
        // Getting Chromium crashes on certain KitKat devices. Might be caused by hardware acceleration
        webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    webView.loadUrl(uri);
    webView.setBackgroundColor(Color.TRANSPARENT);
    return new AlertDialog.Builder(getActivity())
            .setTitle(R.string.about)
            .setView(webView)
            .setPositiveButton(R.string.ok, null)
            .create();
}
 
源代码12 项目: MiBandDecompiled   文件: PKDialog.java
private void c()
{
    m = new a((Context)o.get());
    m.setBackgroundColor(0x66000000);
    m.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(-1, -1));
    n = new WebView((Context)o.get());
    n.setBackgroundColor(0);
    n.setBackgroundDrawable(null);
    android.widget.RelativeLayout.LayoutParams layoutparams;
    if (android.os.Build.VERSION.SDK_INT >= 11)
    {
        try
        {
            Class aclass[] = new Class[2];
            aclass[0] = Integer.TYPE;
            aclass[1] = android/graphics/Paint;
            Method method = android/view/View.getMethod("setLayerType", aclass);
            WebView webview = n;
            Object aobj[] = new Object[2];
            aobj[0] = Integer.valueOf(1);
            aobj[1] = new Paint();
            method.invoke(webview, aobj);
        }
        catch (Exception exception)
        {
            exception.printStackTrace();
        }
    }
    layoutparams = new android.widget.RelativeLayout.LayoutParams(-1, p);
    layoutparams.addRule(13, -1);
    n.setLayoutParams(layoutparams);
    m.addView(n);
    m.a(this);
    setContentView(m);
}
 
源代码13 项目: turbolinks-android   文件: TurbolinksView.java
/**
 * <p>Attach the swipeRefreshLayout, which contains the shared webView, to the TurbolinksView.</p>
 *
 * @param webView              The shared webView.
 * @param screenshotsEnabled   Indicates whether screenshots are enabled for the current session.
 * @param pullToRefreshEnabled Indicates whether pull to refresh is enabled for the current session.
 * @return True if the webView has been attached to a new parent, otherwise false
 */
boolean attachWebView(WebView webView, boolean screenshotsEnabled, boolean pullToRefreshEnabled) {
    if (webView.getParent() == refreshLayout) return false;

    refreshLayout.setEnabled(pullToRefreshEnabled);

    if (webView.getParent() instanceof TurbolinksSwipeRefreshLayout) {
        TurbolinksSwipeRefreshLayout previousRefreshLayout = (TurbolinksSwipeRefreshLayout) webView.getParent();
        TurbolinksView previousTurbolinksView = (TurbolinksView) previousRefreshLayout.getParent();

        if (screenshotsEnabled) previousTurbolinksView.screenshotView();

        try {
            // This is an admittedly hacky workaround, but it buys us some time as we investigate
            // a potential bug with Chrome 64, which is currently throwing an IllegalStateException
            // when accessibility services (like Talkback or 1password) are enabled.
            // We're tracking this bug on the Chromium issue tracker:
            // https://bugs.chromium.org/p/chromium/issues/detail?id=806108
            previousRefreshLayout.removeView(webView);
        } catch (Exception e) {
            previousRefreshLayout.removeView(webView);
        }
    }

    // Set the webview background to match the container background
    if (getBackground() instanceof ColorDrawable) {
        webView.setBackgroundColor(((ColorDrawable) getBackground()).getColor());
    }

    refreshLayout.addView(webView);
    return true;
}
 
源代码14 项目: MiBandDecompiled   文件: LoginActivity.java
private void c()
{
    WebView webview = (WebView)findViewById(0x7f0a003b);
    WebSettings websettings = webview.getSettings();
    websettings.setUseWideViewPort(true);
    websettings.setLoadWithOverviewMode(true);
    webview.setLayerType(1, null);
    webview.setBackgroundColor(0);
    webview.setInitialScale((100 * getResources().getDisplayMetrics().densityDpi) / 480);
    webview.loadUrl("file:///android_asset/startup.gif");
    (new Handler()).postDelayed(new b(this), 4800L);
    C.setEnabled(false);
    r.setEnabled(false);
    s.setEnabled(false);
}
 
源代码15 项目: NBAPlus   文件: NewsDetileActivity.java
@Override
protected void initViews() {
    super.initViews();
    mGetIntent=getIntent();
    if(hasTitleImage()) {

        mCollapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar_layout);
        mCollapsingToolbarLayout.setTitle(mGetIntent.getStringExtra(TITLE));
        mTitleImage = (ImageView)findViewById(R.id.titleImage);
        mTitleImage.post(new Runnable() {
            @Override
            public void run() {
                Glide.with(NewsDetileActivity.this).load(mGetIntent.getStringExtra(IMAGE_URL))
                .placeholder(R.color.colorPrimary)
                .into(mTitleImage);
            }
        });

    } else {
        mToolBar.setBackgroundResource(R.color.colorPrimary);

    }
    mWebView = new WebView(getApplicationContext());
    mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.setBackgroundColor(0);
    mWebLayout.addView(mWebView);

    getNewsDetail();
}
 
源代码16 项目: Android_Skin_2.0   文件: WebInitCompat.java
@Override
public void setDefaultAttr(WebView view) {
	// 去除滚动条白色背景,必须在代码里面添加才有效
	view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
	view.setScrollbarFadingEnabled(true);
	view.setDrawingCacheEnabled(true);
	view.setLongClickable(true);
	view.setBackgroundResource(android.R.color.transparent);
	view.setBackgroundColor(Color.TRANSPARENT);
	view.getBackground().setAlpha(0);
	view.setFocusable(true);
	view.setFocusableInTouchMode(true);
}
 
源代码17 项目: iBeebo   文件: LargePictureFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.gallery_large_layout, container, false);

    final WebView large = (WebView) view.findViewById(R.id.large);
    large.setBackgroundColor(getResources().getColor(R.color.transparent));
    large.setVisibility(View.INVISIBLE);
    large.setOverScrollMode(View.OVER_SCROLL_NEVER);

    if (SettingUtils.allowClickToCloseGallery()) {
        large.setOnTouchListener(new LargeOnTouchListener(large));
    }

    LongClickListener longClickListener = ((BigPicContainerFragment) getParentFragment()).getLongClickListener();
    large.setOnLongClickListener(longClickListener);

    final String path = getArguments().getString("path");

    large.getSettings().setJavaScriptEnabled(true);
    large.getSettings().setUseWideViewPort(true);
    large.getSettings().setLoadWithOverviewMode(true);
    large.getSettings().setBuiltInZoomControls(true);
    large.getSettings().setDisplayZoomControls(false);

    large.setVerticalScrollBarEnabled(false);
    large.setHorizontalScrollBarEnabled(false);
    large.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

    boolean animateIn = getArguments().getBoolean("animationIn");

    if (animateIn) {
        showContent(path, large);
    } else {
        /**
         * webview will influence other imageview animation performance
         */
        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
            @Override
            public void run() {
                showContent(path, large);
            }
        }, GeneralPictureFragment.ANIMATION_DURATION + 300);
    }

    return view;
}
 
源代码18 项目: Beats   文件: MenuCredits.java
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	ToolsTracker.info("Opened credits");
	WebView webview = new WebView(this);
	setContentView(webview);
	webview.setBackgroundColor(Color.BLACK);
	String credits =
		"<html><body><font color=\"white\">" +
		"<font size=\"4\"><u><b>Devs</b></u></font>" +
		"<font size=\"2\"><br/>" +
		"<b>Philip Peng</b> (Keripo)" +
		"<br/>Keripo is the project's lead developer/current maintainer and works on the game's timing engine, osu! Mod, and various other features/settings. He is currently a junior  studying Computer Engineering at University of Pennsylvania. You can contact Keripo via email at <i>[email protected]</i> or via freenode's IRC channels: <i>#stepmania-devs #android #android-dev #ipodlinux #stwinglounge</i>" +
		"<br/><br/><b>Matthew Croop</b> (mcroop)" +
		"<br/>Matt worked on the game's graphics engine, holds mechanics, and various optimization stuff. He is currently a junior studying Computer Science at University of Pennsylvania. You can contact Matt via email at <i>[email protected]</i>" +
		"<br/><br/><b>Yui Suveepattananont</b>" +
		"<br/>Yui created part of the game's original graphics. She is currently a sophomore studying Digital Media Design at University of Pennsylvania. You can contact Yui via email at <i>[email protected]</i>" +
		"</font>" +
		"<br/><br/><font size=\"4\"><u><b>Thanks</b></u></font>" +
		"<font size=\"2\">" +
		"<br/>Special thanks go to:" +
		"<br/>- All the members of the <a href=\"http://beatsportable.com/updates/\">Beats Portable Google group</a> who help out with testing" +
		"<br/>- All the forum users at <a href=\"http://beatsportable.com/forums/\">Beats Portable forums</a> who providing valuable feedback and suggestions" +
		"<br/>- All the IRC-goers at <i>#android-dev</i> for advice/suggestions with programming my first app" +
		"<br/>- All the IRC-goers at <i>#stepmania-devs</i> for helping me with the .sm/.dwi format and simulation" +
		"<br/>- All the devs and peppy at <a href=\"http://osu.ppy.sh/forum/\">osu! forums</a> for providing the .osu format specs (ask peppy for them)" +
		"<br/>- All the translators at <a href=\"http://crowdin.net/project/beats\">Beats crowdin project</a> for help spreading the word (localized!)" +
		"<br/>- All of you users for making this project worthwhile and fun!" +
		"</font>" +
		"<br/><br/><u><font size=\"4\"><b>Credits</b></u></font>" +
		"<font size=\"2\">" +
		"<br/>- Font in logo: <a href=\"http://www.dafont.com/happy-killer.font\">dafont</a>" +
		"<br/>- Double arrow in logo: <a href=\"http://www.psych.ufl.edu/~vollmer/images/750px-Double-arrow.svg.png\">vollmer</a>" +
		"<br/>- File browser/popup icons: <a href=\"http://www.everaldo.com/crystal/\">Crystal Project</a>" +
		"<br/>- .sm file icon: <a href=\"http://www.stepmania.com/wiki/Downloads\">StepMania</a>" +
		"<br/>- .dwi file icon: <a href=\"http://dwi.ddruk.com/downloads.php\">Dance With Intensity</a>" +
		"<br/>- .osu file icon: <a href=\"http://osu.ppy.sh/images/head-left.jpg\">osu!</a>" +
		"<br/>- \"Blue\" background image: <a href=\"http://www.desktopwallpapers.in/images/wallpapers/computer-music-561760.jpeg\">desktopwallpapers</a>" +
		"<br/>- \"Red\" background image: <a href=\"http://media-wallpapers.theotaku.com/1280-by-800-368923-20090813034932.jpg\">theotaku</a>" +
		"<br/>- \"White\" background image: <a href=\"http://www.wallpaper4me.com/images/wallpapers/headphonecommander-406985.jpeg\">wallpaper4me</a>" +
		"<br/>  (based off the original from <a href=\"http://www.diverse.jp/download/d12-hiiragi-1920.jpg\">Diverse System</a>" +
		"<br/><br/><i>~Keripo</i>" +
		"</font>" +
		"</font></body></html>"
		;
	webview.loadData(credits, "text/html", "utf-8");
}
 
源代码19 项目: QuestionnaireView   文件: QuestionnaireView.java
private void drawInnerViews(Context context, AttributeSet attrs){
    float density = context.getResources().getDisplayMetrics().density;
    int value16 = (int)(16*density);
    int value10 = (int)(10*density);
    int value40 = (int)(40*density);
    LayoutParams mainLayoutParams = new LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    mainLayoutParams.setMargins(value16,value16,value16,value16);
    setLayoutParams(mainLayoutParams);

    //creation & addition of webview
    webview = new WebView(context, attrs);
    webview.setId(android.R.id.content);
    webview.setLayoutParams(
            new LayoutBuilder()
                    .addWidth(LayoutParams.MATCH_PARENT)
                    .addHeight(LayoutParams.WRAP_CONTENT)
                    .setMargin(value10,value40,0,0)
                    .create()
    );
    webview.getSettings();
    webview.setBackgroundColor(Color.argb(0,0,0,0));
    addView(webview);

    //creation of list view
    listView = new ListView(context, attrs);
    listView.setId(android.R.id.list);
    listView.setLayoutParams(
            new LayoutBuilder()
                    .addWidth(LayoutParams.MATCH_PARENT)
                    .addHeight(LayoutParams.WRAP_CONTENT)
                    .setMargin(0,value10,0,0)
                    .addRule(BELOW, webview.getId() )
                    .create()
    );
    addView(listView );

    //creation & addition of editText
    editTv = new AppCompatEditText(context, attrs);
    editTv.setVisibility(GONE);
    editTv.setId(android.R.id.text1);
    editTv.setLayoutParams(
            new LayoutBuilder()
                    .addWidth(LayoutParams.MATCH_PARENT)
                    .addHeight(LayoutParams.WRAP_CONTENT)
                    .setMargin(value10, value10, 0, 0)
                    .addRule(BELOW, webview.getId())
                    .create()
    );
    editTv.setInputType(InputType.TYPE_CLASS_TEXT);
    editTv.setImeOptions(EditorInfo.IME_ACTION_DONE);
    addView(editTv );

}
 
源代码20 项目: mv-android-client   文件: WebPlayerView.java
@Override
@TargetApi(Build.VERSION_CODES.M)
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
    super.onReceivedError(view, request, error);
    view.setBackgroundColor(Color.WHITE);
}