Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android creating ViewPropertyAnimator animation chain

I'm trying this:

public void onClick(View view){
    tv.animate().x(600).y(100).scaleX(3).scaleY(3);
    tv.animate().x(400).y(1400).scaleX(1).scaleY(1);
}

but it skips the the first line of animation. How can I make it chain them so first it will do the first line and then the next?

like image 534
Igor Avatar asked Jul 27 '13 15:07

Igor


1 Answers

You can try this

 Runnable endAction = new Runnable() {
     public void run() {
         tv.animate().x(400).y(1400).scaleX(1).scaleY(1);
     }
 };

tv.animate().x(600).y(100).scaleX(3).scaleY(3).withEndAction(endAction);

as suggested in documentation.

like image 157
Desert Avatar answered Oct 19 '22 09:10

Desert