just open it in web view webview.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); webview.setBackgroundColor(0); webview.setInitialScale(110); form.addView(webview); webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(false); if (url.contains("www.twitter.com")) url=url.replace("www.twitter.com", "twitter.com"); webview.loadUrl(url);
On Mar 22, 1:33 am, Dale <dale.ham...@gmail.com> wrote: > 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en