Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Background color and font color

I want to change my WebView's background color and font size.

like image 928
zayar Avatar asked Aug 02 '10 15:08

zayar


People also ask

How do you change background color and font color in HTML?

To add background color in HTML, use the CSS background-color property. Set it to the color name or code you want and place it inside a style attribute. Then add this style attribute to an HTML element, like a table, heading, div, or span tag.

How do I change my font background color?

Go to Design > Page Color. Choose the color you want under Theme Colors or Standard Colors. If you don't see the color you want, select More Colors, and then choose a color from the Colors box.

Is there any difference between font color and background color?

Answer: The font colour option, when enabled in a text, changes the Colour of the font itself. I.e. the letters will change their color as selected whereas, the Text highlight colour option doesn't changes the font colour, instead the background colour of the text changes.

How do you change the font color with CSS?

Simply add the appropriate CSS selector and define the color property with the value you want. For example, say you want to change the color of all paragraphs on your site to navy. Then you'd add p {color: #000080; } to the head section of your HTML file.


2 Answers

Assuming that you have defined your webview in an XML layout resource you can do the following:

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

You may also want to enable javascript and create a simple WebClient to handle page loading

Hope it helps!

like image 52
jagsaund Avatar answered Oct 14 '22 18:10

jagsaund


You could call some javascript that would modify the CSS of the loaded page.

like image 45
cottonBallPaws Avatar answered Oct 14 '22 16:10

cottonBallPaws