Android Question How to continuously apply SetLayoutAnimated

ducphu

Active Member
Licensed User
Hi all,

Let say I have a label. It's initial position is X1, Y1. I would like to set an animation to move it to X2, Y2, then X3, Y3, something like making a ^ move.

X2Y2
X1Y1 X3Y3

I tried to use 2 SetLayoutAnimated continuously
B4X:
lb.SetLayoutAnimated(1000,X2,Y2,width,height)
lb.SetLayoutAnimated(1000,X3,Y3,width,height)
But when I test, the lb seems to be appear immediately at X2 Y2 and then move to X3 Y3, e.g I can not see the movement from X1 Y1 to X2 Y2.
 

Erel

Administrator
Staff member
Licensed User
This code cannot work as SetLayoutAnimated is not a blocking method.

You can use a timer with an interval of 1000. Start the second animation from Timer_Tick event.

Another option is to use the Animation library.
 
Top