<span style= "FONT-SIZE:18PX;" > </span>
<span style= "FONT-SIZE:18PX;" > Recently used <a target=_blank href= "Https://github.com/skyfishjy/android-ripple-background" >https:// Github.com/skyfishjy/android-ripple-background</a> Open source Control, when the android4.0.x encountered a problem, the original elegant animation has become very fast. </span>
<span style= "FONT-SIZE:18PX;" ></span>
<span style= "FONT-SIZE:18PX;" > just started to think it was a hardware acceleration problem, but after checking the data, found that Google in 4.0 when the default hardware acceleration is turned on, so the version above should be the same. Later and colleagues study together when found, seems to be animatorset.setduration () method has no effect, and check the source found the following differences:</span>
API 15
/** * Sets the length of each of the "current" child animations of this animatorset. By default, all child animation would use the its own duration. If the duration is set to the Animatorset, * then each child animation inherits this duration. * * @param duration The length of the animation, in milliseconds, of each of the child * animations of this Animat Orset. */ @Override public animatorset setduration (long duration) { if (Duration < 0) { throw new IllegalArgumentException ("duration must be a value of zero or greater"); } Just record the value for now-it would be used later when the animatorset starts mduration = duration; return this; }
API 19
/** * Sets the length of each of the "current" child animations of this animatorset. By default, all child animation would use the its own duration. If the duration is set to the Animatorset, * then each child animation inherits this duration. * * @param duration The length of the animation, in milliseconds, of each of the child * animations of this Animat Orset. */ @Override public animatorset setduration (long duration) { if (Duration < 0) { throw new IllegalArgumentException ("duration must be a value of zero or greater"); } for (Node node:mnodes) { //Todo:don ' t set the duration of the timing-only nodes created by Animatorset to // Insert "Play-after" delays node.animation.setDuration (duration); } mduration = Duration; return this; }
It turns out that the Animatorset.setduration () method on the API15 does not give it a sub-objectanimator setting, The solution, of course, is to set your own duration for each objectanimator that you add to Animatorset.
This is the most typical version of Android compatibility problem, step over the pit and don't do it again.
Android 4.0.x on animatorset.setduration on the pit