android - Setting end values without animation with AnimatorSet -
according documentation http://developer.android.com/reference/android/animation/animatorset.html#end() end() method should assign end values animations inside set. ending nothing if set not started. different valueanimator i.e. not care , artifically starts animation, fires onanimationstart() event , ends results in setting end values properly.
let me tell why problem. if want have ability update view , without animation (depending on situation) don't want have 2 separate methods it. instead create animation , start or set end values. valueanimator works nicely. animatorset not play ball , if try end before calling start() exits.
one workaround call start() , end() after not cover situation nested animatorsets this:
animatorset mainset = new animatorset(); animatorset scaleset = new animatorset(); scaleset.playtogether( objectanimator.offloat(view, "scalex", 0.5f), objectanimator.offloat(view, "scaley", 0.5f)); mainset.playsequentially( objectanimator.offloat(view, "alpha", 0.5f), scaleset); mainset.start(); mainset.end();
this causes mainset call end() on children. since animatorset.end() broken scaleset not set ending values. attempted extend animatorset class , fix found out marked final.
in app use animations have few cases animations not needed. have idea how achieve proper behaviour?
you can on child animations with:
for (animator animation : mainset.getchildanimations()) { animation.start(); animation.end(); }
Comments
Post a Comment