I need to change Text color based on background image. My background image contains multiple colors. So, accordingly i have to change my textview color.
<TextView android:id="@+id/txtbloops_flower"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="16dp"
android:layout_centerInParent="true"
android:layout_marginLeft="10dp"
android:textColor="#ffffff"/>
please guide me, how to do this.
Basically you have the option to set the transparency (opacity) and the color using android:background.
The hex value that you set it to is composed of 3 to 4 parts:
Alpha (opacity), i'll refer to that as aa
Red, i'll refer to it as rr
Green, i'll refer to it as gg
Blue, i'll refer to it as bb
Without an alpha (transparency) value:
android:background="#rrggbb"
With an alpha (transparency) value:
android:background="#aarrggbb"
The alpha value for full transparency is 00 and the alpha value for no transparency is FF
You can experiment with values in between those.
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