'How to load svg images in compose properly?

I am trying to load SVG file in Jetpack compose, but it turned out to be black when i run it on the phone.

enter image description here

Here is the image from my phone.

enter image description here

I don't want to use tint modifier, because it is going to load the SVG in a single color.



Solution 1:[1]

Use Image composable instead of Icon. Icon is doing tint by default. Source - you can read the docs for Icon.

Icon component that draws [imageVector] using [tint], defaulting to [LocalContentColor].

Also - you can just use painterResource instead of ImageVector.vectorResource.

And just for the future - never attach code as a screenshot on StackOverflow. Just attach code

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jakoss