zayar
zayar

Reputation: 431

Change Background color and font color

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

Upvotes: 8

Views: 14456

Answers (3)

cottonBallPaws
cottonBallPaws

Reputation: 21600

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

Upvotes: 2

jagsaund
jagsaund

Reputation: 2387

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!

Upvotes: 20

Martin
Martin

Reputation: 11855

I would think you can't - unless you control the html data displayed.

The font and background are controlled by the html data feed to the Webview and not the Webview itself.

Upvotes: 0

Related Questions