I want to customize my togglebutton so that they receive this:
but for now I can not change my style
I do not see how to add a background. When I do a tb.background = "#FF0000"
I want to customize my togglebutton so that they receive this:
but for now I can not change my style
I do not see how to add a background. When I do a tb.background = "#FF0000"
The error message tells you what to do to fix your problem:
tb.background = "#FF0000"
"Type mismatch: inferred type is String but Drawable! was expected"
Backgrounds must be of type Drawable
(ignore the exclamation mark for now but it basically means that Kotlin can't infer if the Drawable has to be null or non-null).
You have passed a String
as a background - hence the type mismatch.
To fix it, have a look at this question and adapt one of the answers there.