In android, the response of the animator and its listeners to the cancel and end operations
1. When multiple animations exist in the AnimatorSet and the set and animator listeners are added:
During start, the start method of each animator listener is executed, and the start method of the set listener is called.
When you call the cancel () method of the AnimatorSet, The cancel Method of set is called first, and then the cancel and end methods are called cyclically for each animator, and the end method of set is called finally.
As shown in the following figure, alphaAnim and scaleAnim are both executed in animSet. The Listener is registered, animSet is started, and the cancel method is executed midway through the execution. The call is as follows:
AlphaAnim start
ScaleAnim start
AnimSet start
AnimSet cancel
AlphaAnim cancel
AlphaAnim end
ScaleAnim cancel
ScaleAnim end
AnimSet end
The animSet end method is called during animSet execution. The Calling sequence is as follows:
AlphaAnim start
ScaleAnim start
AnimSet start
AlphaAnim end
ScaleAnim end
AnimSet end
2. Use ScaleAnimation, AlphaAnimation, and AnimationSet to implement the animSet cancel method. The procedure is as follows:
ScaleAnim start
AlphaAnim start
AnimSet start
AnimSet end
AnimSet end
ScaleAnim end
AlphaAnim end
AnimSet end
The execution process when using the animationSet is a bit strange. The set end method is called three times, which is incomprehensible .. After reading the code, I didn't do anything. I bound several listeners. Theoretically, there is no problem.