【问题标题】:how to apply many rotate translate,scale animation to imageview in android如何在android中将许多旋转平移,缩放动画应用于imageview
【发布时间】:2013-08-10 09:49:22
【问题描述】:

嗨,我在这里做一个应用程序,当我的活动开始时,我需要先旋转图像,然后我需要将图像从顶部移动到中心,我必须在一段时间后缩放我的图像,我必须在我的 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);


}
}

【问题讨论】:

    标签: android android-emulator


    【解决方案1】:
    猜你喜欢
    • 2012-07-08
    • 2014-06-01
    • 2015-03-30
    • 1970-01-01
    • 2019-02-05
    • 1970-01-01
    • 1970-01-01
    • 2012-08-23
    • 1970-01-01
    相关资源
    最近更新 更多