Can't find the way to move an image (or others clickable objects)

In your comment you mention how the image ‘flashes’ when it arrives at it’s destination and then you no doubt set the image translation to the new position.

After much testing I found the best way to move an image (or any view) is to perform the steps in the following order:

On Click Event:
1. Find the coordinates of where you want the image to move to
2. Translate (set the position of) the image to where you want it to finish
3. Start an animation which starts from where the image was originally and ends back at it’s current position (0,0).

Because the image has been moved to the end location and then instantly starts an animation you don’t get any flashing at the beginning of the animation, then when the animation finishes it will end exactly where the image is already set to so you don’t get any flashing at the end either.

It is a little strange but I believe it’s just because of how Android triggers the Start/End Animation events.

I hope that makes sense.

Browse More Popular Posts

Leave a Comment