Skip to content

Instantly share code, notes, and snippets.

@tklee1975
Created January 26, 2016 02:01
Show Gist options
  • Select an option

  • Save tklee1975/0f4a39b82c8580955d5c to your computer and use it in GitHub Desktop.

Select an option

Save tklee1975/0f4a39b82c8580955d5c to your computer and use it in GitHub Desktop.
Cannot do "Animation" after using Object Animator!
final TextView view = new TextView(getContext());
view.setBackground(Color.RED);
addSubview(view, 100, 100, 100, 100); // my method: param: view, x, y, width, height
// Playing objectAnimator
Animator anime = (Animator) AnimatorInflater.loadAnimator(this.getContext(), R.anim.pulse);
anime.setTarget(view);
// Try to listen to the end of the animation
anime.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
// This isn't working;
// To solve: change to Animator instead!
Animation anime = AnimationUtils.loadAnimation(getContext(), R.anim.fadein);
view.startAnimation(anime);
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
anime.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment