Issue
Okay so I have created my own .SVG vector icon and imported it as an XML in Android Studio. Now I'm trying to create an Icon using that same vector. However when I specify that vector in painterResource() it paints it in Black color. And my original SVG has multiple colors instead. Any raesons why is this happening?
Icon(
painter = painterResource(id = R.drawable.ic_google_logo),
contentDescription = "Google Button"
)
When I add that icon this is what I see:
And this is how that icon should be actually displayed:
Solution
The Icon
applies a default tint (LocalContentColor.current.copy(alpha = LocalContentAlpha.current)
)
Use tint= Color.Unspecified
to avoid it:
Icon(
painter = painterResource(id = R.drawable.ic_google_logo),
contentDescription = "Google Button",
tint= Color.Unspecified
)
Answered By - Gabriele Mariotti
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.