androidsvgsvg-android

Android svg parsing , official library issues


Hello im writing an android app using the android svg-android.jar. (I think it's the google official library) I'm trying to parse my svg im getting an error. my svg falls on this line :

<stop  offset="0.1774" style="stop-color:#EDEDED;stop-opacity:0.2"/>

the error i get is this : java.lang.NumberFormatException: Invalid int: "EDEDED;stop-opacity:0.2"

in the google code for the project i saw this :

if (gradient != null) {
                    float offset = getFloatAttr("offset", atts);
                    String style = getStringAttr("style", atts);
                    if (style.startsWith("stop-color:#")) {
                        int color = Integer.parseInt(style.substring("stop-color:#".length()), 16);
                        color |= 0xFF000000;
                        gradient.positions.add(offset);
                        gradient.colors.add(color);
                    }
                }

it seems that google can't handle the style having opacity too. the svg itself is generated through a program . my question is this: is there another android library for svg parsing ? i searched and couldn't find .

does the google code site doens't have the latest code ?(google i heard stopped supporting it)

is there another way to give opacity to the stop element which doesn't include the style attribute ?

or most annoying option should I wait for whoever wrote it to fix it ?(commented on google code project site also but the last comment is from 2014 don't know if i get referrenced at all).

help would be appreciated thanks !


Solution

  • There is another to give opacity to the stop element which doesn't include the style attribute, mapped CSS attributes e.g.

    <stop offset="0.1774" stop-color="#EDEDED" stop-opacity="0.2"/>