Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make text color as transparent in listview android?

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"/>

enter image description here

please guide me, how to do this.

like image 357
koti Avatar asked Dec 12 '22 08:12

koti


1 Answers

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.

like image 130
sachin10 Avatar answered Dec 13 '22 21:12

sachin10