TextDrawable
TextDrawable copied to clipboard
Random color doesn't work
Hi, This is the code I have private val textBuilder = TextDrawable.builder() private val colorGenerator = ColorGenerator.MATERIAL;
fun String.toTextDrawable() : TextDrawable {
return textBuilder.buildRound(
this[0].toString(),
colorGenerator.randomColor
)
}
The generated drawable has aways a gray background.
I faced something similar today and wasted 30 minutes looking in the wrong place. Turns out I was using :tint in my XML to color the imageview gray. Remove that property fixed the issue for me.