I am working on an app which needs to display some dynamically queried
HTML content, including CSS.
WebView seems to be the best implementation for this type of work.
I ran into an error when testing it out, and tracked it down to the
following css tag:
hr{width:100%!important}
Android WebView seems to be incapable of displaying any html that
includes this line.
Some research shows that the <hr width=100%/> attribute was depricated
(link: http://www.w3schools.com/tags/att_hr_width.asp), but it works
on all browsers.
Below is some html, including this line. It will render fine in any
browser.
<html><head><style type=\"text/css\">
hr{width:100%!important}
</style></head><body>
Some text
</body></html>
And, in Android:
String exampleCSS = "<html><head><style type=\"text/css\">" +
"hr{width:100%!important}" +
"</style></head><body>" +
"Some text" +
"</body></html>";
WebView webView = (WebView) findViewById(R.id.web_html_about);
webView.loadData(exampleCSS, "text/html", "utf-8");
The result is a "Web page not available" error in the webview.
Is this a known issue due to deprecation? Is it a bug with WebView?
Is there any known work around for such issues?
Cheers,
Dale.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en