Change the color of the text as the progress bar fills below the text

In an Android application, I need to make a layout on top that contains ProgressBartext as shown in the image.

enter image description here

As you can see in this image, the text is initially blue and ProgressBarwhite. Since it ProgressBarfills in blue, what I need to implement is to change the color of the text to white until the part is filled ProgressBar. Can anyone help with the logic for this?

+4
source share
1 answer

you can use ArgbEvaluatorto get a new color

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

0 1

+3

Source: https://habr.com/ru/post/1659596/


All Articles