Reputation: 652
I have an app which is developed with android 4.03 - API Level 15. It has a webView which i want to use to show an html page with some svg content. Some svg content are directly embeded to html and some are dynamically rendered using javascript.
I have a huawei S7 tablet which runs with android 2.2. I have added a backward compatibility pack so i can run my app in the tab.
Now when i create the html page and run it in the dektop browser it perfectly renders all the svg conent. When i run the app in the tablet it doesn't show any svg content. It just displays a white background. But when i try the same app in my friends nexus 7 tablet with android 4.3 it perfectly shows all the svg content in the webView.
I use this code to initialize the webView
WebView mapView;
mapView = (WebView) findViewById(R.id.mapview);
mapView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
}
});
WebSettings s = mapView.getSettings();
s.setLoadWithOverviewMode(true);
s.setLoadsImagesAutomatically(true);
s.setUseWideViewPort(true);
s.setJavaScriptEnabled(true);
s.setSupportZoom(true);
s.setBuiltInZoomControls(true);
File externalStorage = Environment.getExternalStorageDirectory();
String url = "file:///" + externalStorage + "/floor_one.html";
mapView.loadUrl(url);
Is there any compatibility issue in android 2.2 webView with SVG ?
Upvotes: 1
Views: 12273
Reputation: 3458
SVG was not supported before Android 3.0, so you have to find some workaround.
This blog post explains two of Javascript polyfills for SVG.
Upvotes: 4
Reputation: 7108
What if you add this:
webView.getSettings().setPluginState(PluginState.ON);
The only parameter I can see that you dont have that might have an effect.
Upvotes: 0