简体   繁体   中英

How to identify subelements from SVG in android?

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.

在此处输入图片说明

What is the appropriate way to do this?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM