簡體   English   中英

如何在Android中將許多旋轉平移,縮放動畫應用於imageview

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

嗨,我正在做一個應用程序,當我的活動開始的時候,我需要先旋轉圖像,然后我需要將圖像從頂部移動到中心,我不得不在一段時間后必須縮放圖像,才能在可見的圖像視圖中顯示,我嘗試在下面使用代碼首先我應用了旋轉動畫,然后我應用了翻譯動畫。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