Skip to content

Instantly share code, notes, and snippets.

@jromero
Created March 3, 2014 19:02
Show Gist options
  • Save jromero/9332165 to your computer and use it in GitHub Desktop.
Save jromero/9332165 to your computer and use it in GitHub Desktop.
Android: TextColorAnimator, animates the color of a given TextView.
class TextColorAnimator extends ValueAnimator implements AnimatorUpdateListener {
private TextView mTextView;
private TextColorAnimator(TextView textView, int startColor, int endColor) {
mTextView = textView;
setObjectValues(startColor, endColor);
setEvaluator(new ArgbEvaluator());
addUpdateListener(this);
}
@Override
public void onAnimationUpdate(ValueAnimator animator) {
mTextView.setTextColor((Integer) animator.getAnimatedValue());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment