0
我想在onAnimationRepeat
中執行一些操作。 其我的代碼:onAnimationRepeat中的代碼未運行
final LinearLayout l = (LinearLayout) findViewById(R.id.parent);
//line 03
RotateAnimation anim = new RotateAnimation(0, 0, 0, 0);
anim.setInterpolator(new LinearInterpolator());
anim.setRepeatCount(4);
anim.setDuration(10);
anim.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
//line 01
View v = LayoutInflater.from(MainActivity.this).inflate(
R.layout.product_layout, null);
TextView t = (TextView) v.findViewById(R.id.test);
t.setText(i + "");
View root = v.findViewById(R.id.root);
View face = v.findViewById(R.id.face);
View back = v.findViewById(R.id.back);
l.addView(v);
flipCard(root, face, back);
//line 02
i++;
}
@Override
public void onAnimationEnd(Animation animation) {
}
});
l.startAnimation(anim);
但它不工作。 當我將line 01
-line 02
代碼複製到line 03
中時,它們都被執行(複製代碼和line 01
-line 02
代碼)。
什麼是問題? 謝謝