android - Making textView loop a growing and shrinking animation -
i trying make textview grow , shrink. process should repeated infinitely. how achieve that? scale.xml looks this:
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <scale android:fromxscale="1.0" android:fromyscale="1.0" android:toxscale="2.0" android:toyscale="2.0" android:duration="1400" /> </set>
here's animation method:
public void runanimation() { animation = animationutils.loadanimation(this, r.anim.scale); a.setrepeatmode(animation.reverse); a.setrepeatcount(animation.infinite); a.reset(); textview.clearanimation(); textview.startanimation(a); }
now problem textview grows, reverses starting appereance. why won't go reverse, shrink , repeat process?
try :
public void runanimation() { animation = animationutils.loadanimation(this, r.anim.scale); a.setrepeatmode(animation.reverse); a.setrepeatcount(-1); textview.clearanimation(); textview.startanimation(a); }
edit
here own code working right :
call animate animate(textview)
public void animate (view view) { manimation = new scaleanimation(0.3f,0.5f,0.3f,0.5f,animation.relative_to_self, 0.5f, animation.relative_to_self, 0.45f); manimation.setduration(300); manimation.setrepeatcount(-1); manimation.setrepeatmode(animation.reverse); manimation.setinterpolator(new accelerateinterpolator()); manimation.setanimationlistener(new animation.animationlistener(){ @override public void onanimationstart(animation animation) { } @override public void onanimationend(animation animation) { } @override public void onanimationrepeat(animation animation) { } }); view.setanimation(manimation); }
Comments
Post a Comment