Dhiraj Sharma
Dhiraj Sharma

Reputation: 105

Change color of text as progressbar fills below text

In an android app, i need to make a layout on the top of which contains a ProgressBar with text as shown in image.

enter image description here

As you can see in this image, the text is initially of blue color and the ProgressBar is of white color. As the ProgressBar fills in blue color, what i need to implement is to change color of text to white till the part ProgressBar has been filled. Can someone help with the logic for same?

Upvotes: 4

Views: 384

Answers (1)

Blackbelt
Blackbelt

Reputation: 157467

you can use ArgbEvaluator, to get the new color

final ArgbEvaluator evaluator = new ArgbEvaluator();
int color = evaluator.evaluate(progress, YOUR_BLUE_HERE, Color.WHITE);

progress as to be a float between 0 and 1

Upvotes: 3

Related Questions