0

I need to programatically change the trasparency and color gradient gradually. Let's say I have a textview with background #FF0000FF (solid blue, no transparency) and i need it to change gradually to something that looks like #CC000000 (black background with 80% opacity). Let's say I also have a variable i that gradually goes from 0 to 100, how can I make #FF0000FF transform to #CC000000 along with it?

nomongo
  • 3,435
  • 7
  • 30
  • 33

1 Answers1

0

check this link for Setting the transparent background color gradient

try this code

   <TextView
                            android:id="@+id/txtView"
                            android:layout_width="58dp"
                            android:layout_height="58dp"
                            android:gravity="center"
                            android:textColor="@color/white_font"
                            android:textSize="20sp"
                            android:background="#99000000"
                            android:textStyle="bold" />

Hope this helps...

Community
  • 1
  • 1
i.n.e.f
  • 1,773
  • 13
  • 22
  • 1
    Let's say you have a slider control. As the user slides from A to B, how do you change one color with one transparency to another color with another transparency and gradually? – nomongo Jul 24 '14 at 15:39