Android animation animator Development issues

Source: Internet
Author: User


The following issues were encountered when developing Android animator:

1. Circular playback of Animator:

          in animator animation has looping settings setrepeatcount (valueanimator. INFINITE animatorset :

Private Atomicboolean Isstart = new Atomicboolean (false);


Animatorset.addlistener (New animator.animatorlistener ()  {      @ Override      public void onanimationstart (Animator animation)  {    }         @Override        public void onanimationend (animator animation)  {               if  (Isstart.get ())  {                       Animation.start ();      }  }          @Override       public void onanimationcancel (Animator  Animation)  {    }     @Override        public void onanimatIonrepeat (animator animation)  {        }); AnimatorSet.start ();p Ublic void stoprecognizerviewanim ()  {    isstart.set (false);}


2. About the zoom of a view:

Scale is generally used for zoom for view. If the Groupview is scaled, the internal components are scaled as well. If you do not want to scale the internal view, but only the width or height of the zoom, the implementation of the following code:


Manimatorset = new animatorset (); Valueanimator height = valueanimator.ofobject (New widthevaluator (), mCurrWidth,  Mprewidth); height.setduration (DURATION); manimatorset.playtogether (height); Manimatorset.addlistener (new  Animator.animatorlistener ()  {     @Override     public void  onanimationstart (animator animation)  {             }     @Override     public void  Onanimationend (animator animation)  {             }     @Override     public void onanimationcancel ( animator animation)  {    }     @Override      public void onanimationrepeat (animator animation)  {    }}); Manimatorset.start ();


Private class Widthevaluator extends Intevaluator {@Override Public integer evaluate (float fraction, integer STARTV        Alue, Integer endvalue) {int value = super.evaluate (fraction, Startvalue, endvalue);        Viewgroup.layoutparams layoutparams = Getlayoutparams ();        Layoutparams.width = value;        Setlayoutparams (Layoutparams);    return value; }}


3. If multiple animator in the same animatorset need to set before () or after (), no more before () or after () can be set in the same animatorset. For example, Play (Aanimator). Before (Banimator). Before (Canimator): Is wrong. This is my personal understanding, if not correct, please leave a message to inform.



This article is from the Android-meditation blog, be sure to keep this source http://6246534.blog.51cto.com/6236534/1860430

Android animation animator Development issues

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.