T Thraka Member Licensed User Longtime User Feb 23, 2015 #1 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. Code: Copy Dim ani As Animation ani.InitializeTranslate("", 0, 0, 400dip, 0) ani.Duration = 200 ani.Start(myView)
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. Code: Copy Dim ani As Animation ani.InitializeTranslate("", 0, 0, 400dip, 0) ani.Duration = 200 ani.Start(myView)
T Troberg Well-Known Member Licensed User Longtime User Feb 24, 2015 #2 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). Upvote 0
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 Longtime User Feb 24, 2015 #3 Thraka said: 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. Code: Copy Dim ani As Animation ani.InitializeTranslate("", 0, 0, 400dip, 0) ani.Duration = 200 ani.Start(myView) Click to expand... 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. Upvote 0
Thraka said: 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. Code: Copy Dim ani As Animation ani.InitializeTranslate("", 0, 0, 400dip, 0) ani.Duration = 200 ani.Start(myView) Click to expand... 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.
T Troberg Well-Known Member Licensed User Longtime User Feb 24, 2015 #4 I withdraw my previous comment. I'm not using the animation lib, I'm using the feature which came with B4A 4.0. Upvote 0
I withdraw my previous comment. I'm not using the animation lib, I'm using the feature which came with B4A 4.0.
Erel B4X founder Staff member Licensed User Longtime User Feb 24, 2015 #5 Use View.SetLayoutAnimated: https://www.b4x.com/android/forum/threads/simple-animations-in-b4a-v4-00.47731 Upvote 0
Use View.SetLayoutAnimated: https://www.b4x.com/android/forum/threads/simple-animations-in-b4a-v4-00.47731