Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing text color in a WebView?

There's a method for altering background color but not font.
Any ideas?

like image 345
yanchenko Avatar asked Aug 10 '09 13:08

yanchenko


2 Answers

something like

String text = "<html><head>"           + "<style type=\"text/css\">body{color: #fff; background-color: #000;}"           + "</style></head>"           + "<body>"                                     + your_string_text_here           + "</body></html>";  webview1.loadData(text, "text/html", "utf-8"); 
like image 193
OWADVL Avatar answered Sep 18 '22 02:09

OWADVL


I had to put it in the onPageFinished method.

_webView.setWebViewClient(new WebViewClient() {     public void onPageFinished(WebView view, String url) {         _webView.loadUrl(             "javascript:document.body.style.setProperty(\"color\", \"white\");"         );     } }); 
like image 43
djunod Avatar answered Sep 20 '22 02:09

djunod