Android Question Animation does not stay when finished

Thraka

Member
Licensed User
I'm trying to use the Animation class to move a view on the screen. It works, I see the view move to the desired position but after the animation has finished, the view returns to its original position.

B4X:
Dim ani As Animation
ani.InitializeTranslate("", 0, 0, 400dip, 0)
ani.Duration = 200
ani.Start(myView)
 

Troberg

Well-Known Member
Licensed User
I have seen that happen as well. I thought it was a bug in my code, but I haven't got around to fixing it yet. Perhaps, I now see, it's not.

It doesn't happen on all devices, and it doesn't happen all the time (in my case, it only happens when I don't have a video playing, which is what led me to believe that it was me that had effed up).
 

Informatix

Expert
Licensed User
I'm trying to use the Animation class to move a view on the screen. It works, I see the view move to the desired position but after the animation has finished, the view returns to its original position.

B4X:
Dim ani As Animation
ani.InitializeTranslate("", 0, 0, 400dip, 0)
ani.Duration = 200
ani.Start(myView)
In fact, the Animation lib does not move the view, it just moves an image of this view. That's why the view is still at the same place when the animation ends. You can use the AnimationPlus lib with PersistAfter = true or, much better, you can use the NineOldAndroids lib which really moves the view.
 

Troberg

Well-Known Member
Licensed User
I withdraw my previous comment. I'm not using the animation lib, I'm using the feature which came with B4A 4.0.
 
Top