Apply ARGB color to a textview programmatically
Question
I'm currently using something like: TextView.SetBackgroundColor(Color.WHITE);
in my java code. I'd like to be able to add some transparancy to the textview through the java... This is easy to do in the XML via #AARRGGBB
format, but I have not found a way to accomplish this programmatically.
Solution
TextView.SetBackgroundColor(Color.argb(a_int, r_int, g_int, b_int));
Or:
TextView.SetBackgroundColor(Color.parseColor("#AARRGGBB"));
OTHER TIPS
You can use
TextView.SetBackgroundColor(Color.parseColor("#AARRGGBB"));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow