I want to change the Background of various TextViews at run-time programatically.
I've tried various ways, using setBackground and setBackgroundResouerce together with things like getDrawable
e.g.
and many others, but I just can't come up with a version that works.
I know how to change the backgroundColor but this only gives me a single color for the whole of the TextView. Ideally I'd like to be able to use the shape I've created in the XML file which has a border, rounded corners as well as the main background color.
Can someone please help? I feel like it should be something simple, but none of the searches I've done have produced the answer to this specific scenario..
I don't know for sure, but I wouldn't be surprised if TextView doesn't support anything in the background beyond the color. You could try using a View with the desired characteristics, and then putting the TextView on top of that.
Tim Moores wrote:I don't know for sure, but I wouldn't be surprised if TextView doesn't support anything in the background beyond the color. You could try using a View with the desired characteristics, and then putting the TextView on top of that.
Ah! That would explain why even after an exhaustive search I couldn't find any mention of how to do this!
Thanks
Tim Moores wrote:I don't know for sure, but I wouldn't be surprised if TextView doesn't support anything in the background beyond the color. You could try using a View with the desired characteristics, and then putting the TextView on top of that.
Ah! That would explain why even after an exhaustive search I couldn't find any mention of how to do this!
Thanks
I guess you are looking for "background tint". Should work to change resource programmatically in your Adapters
code is emotional
It was the best of times. It was the worst of times. It was a tiny ad.
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!