将文本颜色URL Webview更改为白色

时间:2019-03-14 12:07:07

标签: android android-webview

我想在离线时将Webview URL的颜色更改为白色,用填充或其他方式隐藏,以使URL在应用程序离线时不可见

enter image description here

    webView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
    webView.loadUrl("https://google.com-example");
    /*webView.loadUrl("http://www.atapkita.com/json/login-master/page-hm.php");*/
    /*http://www.script-tutorials.com/demos/199/index.html*/
    swipe.setRefreshing(false);
    webView.setWebViewClient(new WebViewClient(){

        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {

            webView.loadUrl("file:///android_asset/home-offline/home-offline.html");

2 个答案:

答案 0 :(得分:0)

请在home-offline.html中应用以下代码。

<!DOCTYPE html>
<html><HEAD><meta user-scalable=yes" /></HEAD>
<body>
<div style="color: #FFF;">
#replace content with your offline html content#
</div>
</body>
</html>

答案 1 :(得分:0)

您只需要将WebView Client中的空白页设置为WebView,并向用户显示“您已离线请打开Internet”的消息。

webview.loadUrl("about:blank");
相关问题