I am using Translate Animation for moving an ImageView
. I am using this code:
TranslateAnimation set1 = new TranslateAnimation(-4, 10, -110, 0);
set1.setDuration(3000);
TranslateAnimation set2 = new TranslateAnimation(10, -3, 0, 115);
set2.setDuration(3000);
set2.setStartOffset(2200);
TranslateAnimation set3 = new TranslateAnimation(-3, -20, 0, -100);
set3.setDuration(3000);
set3.setStartOffset(4500);
TranslateAnimation set4 = new TranslateAnimation(0, 13, 0, -120);
set4.setDuration(3000);
set4.setStartOffset(6500);
animSet.addAnimation(set1);
animSet.addAnimation(set2);
animSet.addAnimation(set3);
animSet.addAnimation(set4);
animSet.setFillAfter(true);
After creating a set of animations, I apply them on the ImageView
like this:
image = (ImageView)findViewById(R.id.img);
image.startAnimation(animSet);
Everything is working fine, but I cannot pause the animation and resume on button click.
How can I do that?
I tried everything, but didn't succeed. Any idea how to do this?
Please help!
See Question&Answers more detail:os