Alpha Animation on Label

Bill Norris

Active Member
Licensed User
Longtime User
I wish to have a label and its text be invisible, then use animatealpha to make it fade in and stay visible in response to a particular event. The particular event is not relevant here, just the steps for the fade in. If I set the aspha to 0 in designer, the text of the label is still visible when the activity loads. I want the text to be invisible as well until the animation make it appear.
 
Last edited:

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
Take a look at the attached sample project.

I looked at your code in a text editor (since I couldn't load it into B4A) and saw the line:

Label1.TextColor = Colors.ARGB(AlphaValue, 255, 255, AlphaValue)

Did you intend to put the AlphaValue at the end? (That changes the font color as it's fading in/out, which maybe you intended as a "feature"?)
 
Upvote 0

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
Yes, it fades the text as the OP requested.

The first "AlphaValue" (in the Alpha spot) fades the text. The second one is changing the color, isn't it?

You have:
Colors.ARGB(AlphaValue, 255, 255, AlphaValue)

And the format for ARGB is
Colors.ARGB(Alpha As Int, R As Int, G As Int, B As Int)

I think that the 2nd AlphaValue should just be 255 (or whatever color is wanted)
 
Last edited:
Upvote 0
Top