android - Why my animation keeps on last state? -
i want blinking text, alpha 0.3 alpha 1, thing works good, when anim.cancel() text statys in alpha 0.3, want return full opaque. i've tried setfillafter , setfillbefore no success. question why animation keeps on last state?
time = (textview) findviewbyid(r.id.time); anim = new alphaanimation(0.3f, 1.0f); anim.setduration(100); anim.setstartoffset(100); anim.setrepeatmode(animation.restart); anim.setrepeatcount(animation.infinite); time.startanimation(anim);
you can use this:
textview mytext = (textview) findviewbyid(r.id.mytext ); animation anim = new alphaanimation(0.3f, 1.0f); anim.setduration(100); anim.setstartoffset(100); anim.setfillafter(false); anim.setrepeatmode(animation.reverse); anim.setrepeatcount(animation.infinite); mytext.startanimation(anim);
and when cancel :
mytext.setvisibility(view.invisble); // that's case, if want set alpha 1 - set (view.visible); anim.cancel();
Comments
Post a Comment