Home » Java » How to change a specific text color in webview title

How to change a specific text color in webview title

Posted by: admin October 24, 2018 Leave a comment

Questions:

I want to change a text color in title bar when webview is loading.
In my code below, the text in the setTitle("Loading...");

myWebView.loadUrl("http://example.com");
    myWebView.setWebViewClient(new WebViewClient(){

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            setTitle("Loading...");
            myLinearLayout.setVisibility(View.VISIBLE);
            super.onPageStarted(view, url, favicon);
        }

        @Override
        public void onPageFinished(WebView view, String url){
            setTitle("Test Site");
            myLinearLayout.setVisibility(View.GONE);
            swipe.setRefreshing(false);
            myCurrentUrl = url;
            super.onPageFinished(view, url );
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (Uri.parse(url).getHost().equals("example.com")) {
                return false;
            }
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            startActivity(intent);
            return true;
        }

    });

Please can somebody help fiddle my code for me. Thank you all for your efforts.
I am absolute beginner, so please explain it more to me.Thanks once again.

Answers: