Reputation: 51
I am programming a board game using the Android Platform. I am using Tween Animation, specifically the TranslateAnimation tool to create an animation that moves an ImageView object across the screen. I would like that ImageView to remain in its new position after the animation finishes. Please teach me how to do this?
This is a snippet of code that I am using to run the animation.
ImageView image = (ImageView) findViewById(R.id.ImageView)
Animation personal = new TranslateAnimation(0,100,0,100);
personal.setDuration(2000);
image.startAnimation(personal);
I am using Java to declare the animation instead of using an xml file because I don't know how to modify the fromXDelta, toXDelta, fromYDelta, toYDelta variables inside of the main class code.
Upvotes: 2
Views: 1271
Reputation: 856
I think you should set the image layout params. To keep the position in the end; the first answer I tried it, it was not useful.
Upvotes: 0