Android Question How to continuously apply SetLayoutAnimated

Discussion in 'Android Questions' started by ducphu, Aug 29, 2015.

  1. ducphu

    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
    Code:
    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.
     
  2. Erel

    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.
     
    behimiri likes this.
  3. ducphu

    ducphu Active Member Licensed User

    ok thank Erel
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice