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.
TextView Text Color – To change the color of text in TextView, you can set the color in layout XML file using textColor attribute or change the color dynamically in Kotlin file using setTextColor() method.
Tint color means when we want to change the color of the image while rendering in ImageView. In XML is very easy to change tint color by just setting up the attribute android:tint="" in the ImageView tag, as shown in the following example.
To change the background color of TextView widget, set the background attribute with required Color value. You can specify color in rgb , argb , rrggbb , or aarrggbb formats. The background color is applied along the width and height of the TextView.
You can use
TextView.SetBackgroundColor(Color.parseColor("#AARRGGBB"));
TextView.SetBackgroundColor(Color.argb(a_int, r_int, g_int, b_int));
Or:
TextView.SetBackgroundColor(Color.parseColor("#AARRGGBB"));
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