How to identify subelements from SVG in android?

47 views Asked by At

I'm using SVG rendering library for Android create a drawable vector by parsing SVG. Then I want to identify elements of it and make them fillable.

For example I want to identify all six elements separately in the SVG file as follows and I want to make them fillable.

enter image description here

What is the appropriate way to do this?

1

There are 1 answers

0
Paul LeBeau On

AndroidSVG is currently render-only. So you can't modify the SVG or recolour any part of it and re-render.

I see two solutions:

  1. Load your SVG in as a string. Then recolour your image by modifying the SVG using string manipulations, then pass it to AndroidSVG via an InputStream.

  2. Have a stack of seven SVGs. One for each petal colour and the flower outline on top. Then make each petal visible as the right area is clicked on.