こんにちは、私のアクティビティが開始されたときにここで1つのアプリケーションを実行しています。最初に画像を回転させる必要があり、次に画像を上から中央に移動する必要があります。しばらくしてから画像を拡大縮小する必要があります。コード最初に回転アニメーションを適用し、次に変換アニメーションを適用しました.2秒後、スケールアニメーションを適用しましたが、画像は中央でスケーリングされていません.imagviewの元の位置(上部)がスケーリングされていますが、アニメーションを移動した後にimageviewをスケーリングする必要がありますその位置では、スケール イメージ ビューが必要です... 1 つのイメージ ビューにさまざまなアニメーションを適用する方法を提案します。
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);
}
}