Android - Glide 4.0.0-RC0: how to set tint color for ImageView after successfully loading SVG

The Glide SVG loader produces a PictureDrawable. Last I checked, PictureDrawables do not support the setColorFilter() method.

What you could try is making your own version of the SvgDrawableTranscoder that generates a BitmapDrawable instead and draws into that using AndroidSVG's renderToCanvas() method.

Update

AndroidSVG 1.4+ now supports passing extra CSS at render time. Create a RenderOptions object and supply some CSS rules using .css(). You can then pass that RenderOptions object to renderToPicture() in your SvgDrawableTranscoder.

RenderOptions  renderOptions = RenderOptions.create().css("path { fill: red; }");
Picture picture = svg.renderToPicture(renderOptions);
...etc...

RenderOptions documentation


Here my approach working fine

Step-1 Create method for updating imageview color

fun ImageView.paintColor(colorString: String) {
    val paint = Paint()
    val colorFilter = PorterDuffColorFilter(Color.parseColor(colorString), PorterDuff.Mode.SRC_ATOP)
    paint.colorFilter = colorFilter
    setLayerPaint(paint)
}


                      

Step-2 simple call this function where you wants to update this image color

 yourImageView.paintColor("#ff0000")