1

こんにちは、私はここに見られるように翻訳アニメーションを使用しています:

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
     android:fromXDelta="0" 
     android:toXDelta="0%" 
     android:fromYDelta="-150"
     android:toYDelta="125%p" 
     android:duration="4500"/>

アニメーション中にちらつき/ジャークするように見えることを除いて、今では正常に動作しますか? これは標準ですか?

6 つの異なるビューを同時にアニメーション化していますが、これが原因ですか?

これは私がアニメーションを設定する方法です:

// Create animation for  image
for(x = 0; x < 6; x++){
this.movement[x] = AnimationUtils.loadAnimation(this, R.layout.animation_test);
this.movement[x].reset();
this.movement[x].setRepeatCount(Animation.INFINITE);
this.movement[x].setRepeatMode(Animation.RESTART);
this.movement[x].setStartOffset(x * 1250);
this.movement[x].setAnimationListener(this);    
}

// Create Droplet Layout
for(x = 0; x < 6; x++){
this.mDropletLayout[x] = new LinearLayout(this);
// Randomize        
final long rnd = Math.round(Math.random() * 480);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(                                                       RelativeLayout.LayoutParams.WRAP_CONTENT,                                               RelativeLayout.LayoutParams.WRAP_CONTENT);
params.leftMargin = (int) rnd;
this.mLayout[x].setLayoutParams(params);        
}

this.mLayout[0].setBackgroundResource(R.drawable._1);
this.mLayout[1].setBackgroundResource(R.drawable._2);
this.mLayout[2].setBackgroundResource(R.drawable._3);
this.mLayout[3].setBackgroundResource(R.drawable._4);
this.mLayout[4].setBackgroundResource(R.drawable._5);
this.mLayout[5].setBackgroundResource(R.drawable._6);

// Attach
for(x = 0; x < 6; x++){
// Attach Animation
this.mLayout[x].startAnimation(this.movement[x]);
// Attach
this.mBackgroundView.addView(this.mLayout[x]);
}

アニメーションが実際に私にはがらくたのように見えるので、ここで何かが欠けています..?

4

1 に答える 1

1

複数のアニメーションが問題になる場合は、すべての子Viewをより大きな囲みに入れているため、固定する必要がある他の子がない場合はView、アニメーション全体を実行します。それ以外の場合は、アニメーションが必要なすべてのものを含む中間mBackgroundView体を追加します。次に、アニメーションを中間に適用するだけです。ViewmBackgroundViewView

編集: で 6 つの同一のアニメーションを作成していることに気付きましたAnimationUtils。私の理解では、すべてのビューに単一のビューを使用できます。

編集 2: 前ではなく、実行後にアニメーションを開始してみてくださいaddView

于 2011-08-20T01:23:08.443 に答える