I am adding to my layout a WebView to display justified text. I want to set the background of the WebView to be transparent to appear like a textView. Here\'s what I did:
Your html code sets everything to white
Replace:
String textTitleStyling = "<head><style>* {margin:0;padding:0;font-size:20; " +
"text-align:justify; color:#FFFFFF;}</style></head>";
String titleWithStyle = textTitleStyling + "<body><h1>" + movie.synopsis +
"</h1></body>";
synopsis.loadData(textTitleStyling + movie.synopsis, "text/html", "utf-8");
synopsis = (WebView) findViewById(R.id.synopsis);
synopsis.getSettings();
synopsis.setBackgroundColor(0);
With:
This excludes color from header style and applies the rest of the style only to body element
String textTitleStyling = "<head><style>body{margin:0;padding:0;font-size:20; " +
"text-align:justify;}</style></head>";
String titleWithStyle = textTitleStyling + "<body><h1>" + movie.synopsis +
"</h1></body>";
synopsis.loadData(titleWithStyle, "text/html", "utf-8");
synopsis = (WebView) findViewById(R.id.synopsis);
synopsis.getSettings();
synopsis.setBackgroundColor(0);
EDIT: fixed html