Android 4.4 Kitkat Won't Show SVGs in WebView -
Android 4.4 Kitkat Won't Show SVGs in WebView -
i have app shows total screen svg image in webview. works fine in android 4.2 test device , in emulator. in android 4.4 svg image shows broken image.
does have prepare problem or know why happening? thanks.
browser=(clickablewebview)view.findviewbyid(r.id.my_browser); browser.setwebviewclient(new webviewclient()); browser.getsettings().setbuiltinzoomcontrols(true); browser.getsettings().setrenderpriority(renderpriority.high); browser.getsettings().setdisplayzoomcontrols(false); browser.getsettings().setloadwithoverviewmode(true); browser.getsettings().setjavascriptenabled(true); url = "<html><body style=\"margin: 0; padding: 0 \"><table align=\"center\" cellpadding=0 cellspacing=0 style=\"height:100%; width:100%; \"><tr><td align=\"center\" style=\"vertical-align:middle;\"><img src=\"file:///android_res/drawable/" + filename + ".svg\" height=\"" + height + "\"/><br><font size=\"0\">.</font></td></tr></table></body></html>"; browser.loaddatawithbaseurl(url, url, "text/html", encoding.utf_8.tostring(), url);
okay after playing around i've managed prepare it.
for reason on android 4.4, svg images must stored in assets folder (file:///android_asset/). on previous android versions fine store svgs in drawable folders seems not case anymore.
android svg webview
Comments
Post a Comment