嘿伙计们,我正在使用翻译动画,如下所示:
<?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]);
}
现在我在这里错过了什么,因为动画对我来说实际上看起来像垃圾......?