简体   繁体   中英

how to apply many rotate translate,scale animation to imageview in android

Hi am doing one application here when my activity starts that time i need to rotate image first then i need to move image from top to center there i have to scale my image after some time i have to in visable my imageview,i tried using below code first i applied rotate animation then i applied translate animation.after 2 seconds i applied scale animation but image is not scaling in center its taking imagview original postion(top) there its scaling but i need to scale imageview after move animation where is there at that postion i need scale image view...any one suggest how to apply different animations to single imageview.

public class A extends Activity{

TranslateAnimation moveLefttoRight1;
Animation logoMoveAnimation;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
     setContentView(R.layout.game);

final ImageView myImage = (ImageView)findViewById(R.id.imageView1);

     //rotate animation
     final Animation myRotation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotator);
        myImage.startAnimation(myRotation);


        //translate animation
        moveLefttoRight1 = new TranslateAnimation(0, 0, 0, 200);
        moveLefttoRight1.setDuration(2000);
        moveLefttoRight1.setFillAfter(true);
        myImage.startAnimation(moveLefttoRight1);

        //scale animation
      logoMoveAnimation = AnimationUtils.loadAnimation(this, R.anim.sacle); 
          Handler handler = new Handler();
            handler.postDelayed(new Runnable() {
                public void run() {

                    myImage.startAnimation(logoMoveAnimation);
                }
            }, 2000);


}
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM