【问题标题】:How to load svg map files to android如何将svg地图文件加载到android
【发布时间】:2014-03-25 18:57:48
【问题描述】:

我想将我的 svg 文件加载到 android,我可以获取 svg 文件,但地图的某些部分仅显示。并且还收到 logcat 错误,因为“webcoreglue 不应该发生没有找到基于 rect 的测试节点”。

我的代码在这里。

public class MainActivity extends Activity {



    @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
             String url = "http://10.0.2.2:80/file/myfile.html";

            WebView webview = new WebView(this);
            setContentView(webview);

           try {
                webview.loadUrl(url);
            InputStream fin = getAssets().open("url");
            byte[] buffer = new byte[fin.available()];
            fin.read(buffer);
            fin.close();
            webview.loadData(new String(buffer), "text/html", "UTF-8");
           } catch (IOException e) {
              e.printStackTrace();
         }
        }

【问题讨论】:

    标签: android html svg


    【解决方案1】:

    注意在 Honeycomb (3.0) 之前,Android webview 不支持 SVG。如果您运行较旧的程序,则需要尝试一些变通方法(即SVG JavaScript polyfill

    【讨论】:

      猜你喜欢
      • 2023-02-17
      • 2014-04-16
      • 1970-01-01
      • 2020-04-23
      • 1970-01-01
      • 1970-01-01
      • 2020-05-07
      • 2021-12-27
      • 2021-02-15
      相关资源
      最近更新 更多