Skip to content Skip to sidebar Skip to footer

Svg Support In Android

We are going to develop an android application for show a autocad drawing file in svg format in which ecma script is using. We have tested the application in emulator and opened

Solution 1:

Android (3.0 and later) supports SVG with ECMAScript.

The problem is that ecmacript in svg isn't executed when svg is added in the <img> tag. I also tested it in several desktop browsers and when svg is in <img> tag, ecmascript wasn't executed in any of them.

There are 5 ways how to add svg in the html:

  1. Add it as an image with the <img> tag
  2. Embed it with the <embed> tag
  3. Embed it with the <iframe> tag
  4. Embed it with the <object> tag
  5. Embed svg code directly into the html (using <svg> tag)

The ecmascript in the svg is executed only if the svg is embedded in <embed>, <iframe> or <object> tag. When embeding svg code directly in <svg> tag, it might be necessary to do some code changes (e.g. moving the scripts elsewhere in the html), but it should also work.

Post a Comment for "Svg Support In Android"