开发者

Apply ARGB color to a textview programmatically

开发者 https://www.devze.com 2023-01-07 18:50 出处:网络
I\'m cur开发者_如何学JAVArently 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

I'm cur开发者_如何学JAVArently 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.


TextView.SetBackgroundColor(Color.argb(a_int, r_int, g_int, b_int));

Or:

TextView.SetBackgroundColor(Color.parseColor("#AARRGGBB"));


You can use

TextView.SetBackgroundColor(Color.parseColor("#AARRGGBB"));
0

精彩评论

暂无评论...
验证码 换一张
取 消