[Attribute="value"] selector not working.
Currently I was trying to change fill color based on the condition where fill = #000000.
But using the above selector in code doesn't work with library while the same same css style works on w3schools emulator.
Here is the code too.
try
{
String blueEyes = "path[fill=\"#000000\"] {fill: #FFFFFF;}";
RenderOptions renderOpts = RenderOptions.create().css( blueEyes );
SVG svg = SVG.getFromAsset(getAssets(), "drawable.svg");
Drawable drawable = new PictureDrawable(svg.renderToPicture(renderOpts));
imageView.setImageDrawable(drawable);
}
catch(Exception e){
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
and if I change the selector to path {fill: #FFFFFF;} it works but it replaces all the fill occurances.
So is this selector attribute not supported as of yet?
It is supported, but only for id and class.
This is because AdndroidSVG does not have a full SVG DOM implementation. It parses the XML directly into a minimal object format and, in an effort to reduce memory uses, doesn't keep details of all the attribute values. It only keeps id and class. Normally the other attributes aren't needed after the parsing stage.
If you want to add your vote to implementing the DOM, add a thumbs up to issue #130.
Thanks for your report.