The well-known AndroidSVG does not (as at November 2020) allow full user control over FILL and STROKE colour because of a clumsy CSS-based method not currently supporting !important. See here.
This fork gives users the final word on colour by deploying a callback fired whenever the Paint colour is set and came about because my app needs to paint user-defined Inkscape SVGs with appropriately contrasted colours over variously-coloured raster map layers.
It arose because the original author wished to enforce the inferior CSS-based method "for the sake of standards", thereby denying his users the flexibility of deciding for themselves which technique would best suit them.
Add the following to your project build.gradle:
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}and the following to your app build.gradle:
dependencies {
implementation 'com.github.androidsvgCOLOR:1.4.3@aar'
}You must first instantiate com.caverock.androidsvg.SVG.java.
SVG svg;
...
svg.setColourCallback(new SVGBase.ColourCallback(...));
Supply integer paint colours to the callback.
For completeness, here is a HowTo for applying this patch to your fork of the original master.
These were part of my original notes and although superceded still illustrate the approach.