In android, the response of the animator and its listeners to the cancel and end operations

Source: Internet
Author: User

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.





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.