Created
January 26, 2016 02:01
-
-
Save tklee1975/0f4a39b82c8580955d5c to your computer and use it in GitHub Desktop.
Cannot do "Animation" after using Object Animator!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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