• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: How can I create a coloured Icon from a vector drawable resource in Jetpack Compose?

Resolved: How can I create a coloured Icon from a vector drawable resource in Jetpack Compose?

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I want to implement a Sign In With Google button in Jetpack Compose. I downloaded this SVG and added a white background in Inkscape so it would be usable in both the recommended styles (white or blue button background), then imported it into resources.
This is how it looks in the text editor:
I used it in a Button like this:
It renders in colour in Android Studio, but in previews and the emulator it ignores all the fillColor and strokeColor attributes and renders it white. If I remove the background from the XML I can see the G shape, as long as the button doesn’t have a white background. If I restore the background but change its fillColor to something else it stays white.

Answer:

The Icon applies the default tint LocalContentColor.current.copy(alpha = LocalContentAlpha.current)
Use tint= Color.Unspecified to avoid it:
enter image description here

If you have better answer, please add a comment about this, thank you!

android android-jetpack-compose android-vectordrawable
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How do I navigate a table without any easily accessible distinctions?

27/03/2023

Resolved: Can a pod make itself unavailable temporarily in kubernetes?

27/03/2023

Resolved: How to plot logistic probability for custom generalized additive model (GAM) plot?

27/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.