How do I get the background color of a TextView?
When I press the TextView, I want to change the background color according to the background color that is in use.
TextView does not have a method such as:
getBackgroundResource()
Edit: I would prefer to get the resId of the background color.
In Kotlin:
val cd = view.background as ColorDrawable
val colorCode = cd.color
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With