Translate animation?

You've fallen victim to the great misunderstanding everyone first makes about Android animations: the animated ImageView (or whatever kind of view) isn't actually moving (or scaling or rotating or fading). It's all a trick... an animation is essentially some last-minute instructions to the screen composition engine to offset the view by x/y, rotate by z, etc. The view's underlying position / size / angle / alpha never really changes Therefore when the animation ends your image appears to snap back to the starting point, because it never actually left it That said, you can achieve what you want in a simple way by adding android:fillAfter="true to your translate tag. Just bear in mind that the image hasn't really moved.

If you need to update your layout at animation end, hook up an AnimationListener and do it in onAnimationEnd().

You've fallen victim to the great misunderstanding everyone first makes about Android animations: the animated ImageView (or whatever kind of view) isn't actually moving (or scaling or rotating or fading). It's all a trick... an animation is essentially some last-minute instructions to the screen composition engine to offset the view by x/y, rotate by z, etc. The view's underlying position / size / angle / alpha never really changes. Therefore when the animation ends your image appears to snap back to the starting point, because it never actually left it.

That said, you can achieve what you want in a simple way by adding android:fillAfter="true" to your tag. Just bear in mind that the image hasn't really moved. If you need to update your layout at animation end, hook up an AnimationListener and do it in onAnimationEnd().

I tried with android:fillAfter="true"...but its the same as before...then I tried with onAnimationEnd(). I gave visibility of the image as invisible...but still the same thing is happening...any clue on what I have done wrong? – Mathew Nov 18 '10 at 10:27 Probably because you were using a but it hardly matters now.

– Reuben Scratton Nov 18 '10 at 12:08.

I got it...instead of using that animation xml file, I wrote inside java file. Animation animation = new TranslateAnimation(0, 500,0, 0); animation. SetDuration(1000); animation.

SetFillAfter(true); myImage. StartAnimation(animation); myImage. SetVisibility(0); Now the image moves from left to right and then it gets invisible...hence animated!

:).

I don't know why that code works. Doesn't make a lot of sense. Try using View.

VISIBLE in the setVisibility() method. – Macarse Nov 18 '10 at 13:06 setVisibility(0) sometimes its not working...i don't know y...I have kept View. INVISIBLE now, which works........ – Mathew Nov 19 '10 at 6:27 actually, INVISIBLE is int == 1, VISIBLE == 0, gone ==2, here I too had problems with setVisibility in code, so I put View.

VISIBLE/View. INVISIBLE in . SetVisibility – xxxxxxxxxadfas Aug 2 at 6:06.

Register an AnimationListener via setAnimationListener(), and change your text in the listener's onAnimationRepeat() method. Terms of service. Not the answer you're looking for?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions