admin管理员组文章数量:1333172
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 patibility 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 patibility issue in android 2.2 webView with SVG ?
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 patibility 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 patibility issue in android 2.2 webView with SVG ?
Share Improve this question asked Sep 12, 2013 at 5:59 direndddirendd 6522 gold badges16 silver badges47 bronze badges 1- Check out the related post stackoverflow./questions/6677397/svg-support-in-android – GrIsHu Commented Sep 12, 2013 at 6:24
2 Answers
Reset to default 4SVG was not supported before Android 3.0, so you have to find some workaround.
This blog post explains two of Javascript polyfills for SVG.
http://www.kendoui./blogs/teamblog/posts/12-02-17/using_svg_on_android_2_x_and_kendo_ui_dataviz.aspx
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.
本文标签: javascriptAndroid webView support for svg renderingStack Overflow
版权声明:本文标题:javascript - Android webView support for svg rendering - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742349220a2458147.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论