How to set the background color of a WebView to a hex value?

android, android-layout, webview

Solution

Assuming you have defined your `WebView` in an XML resource, you can do the following:

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

Problem

How do I set the background color of a `WebView` to a hexadecimal value? I am open to either via `main.xml` or programmatically.

Original source