简体   繁体   English

如何在Android中将许多旋转平移,缩放动画应用于imageview

[英]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. 嗨,我正在做一个应用程序,当我的活动开始的时候,我需要先旋转图像,然后我需要将图像从顶部移动到中心,我不得不在一段时间后必须缩放图像,才能在可见的图像视图中显示,我尝试在下面使用代码首先我应用了旋转动画,然后我应用了翻译动画。2秒钟后,我应用了缩放动画,但是图像没有居中缩放,但imagview原始位置(顶部)在那里缩放,但是我需要在移动动画之后缩放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);


}
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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