我在Android中遇到動畫問題。在這個動畫的結尾和開始之間,在屏幕上閃爍整個圖像,沒有alpha效果。動畫開頭字母0,用α-0結束得我有這樣的代碼:Android動畫重複
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true" >
<alpha
android:duration="4000"
android:fromAlpha="0.0"
android:interpolator="@android:anim/linear_interpolator"
android:toAlpha="1.0" />
<scale
android:duration="12000"
android:fromXScale="0.5"
android:fromYScale="0.5"
android:pivotX="50%"
android:pivotY="10%"
android:toXScale="3"
android:toYScale="2"
android:interpolator="@android:anim/linear_interpolator"/>
<alpha
android:startOffset="10000"
android:duration="1500"
android:fromAlpha="1.0"
android:interpolator="@android:anim/linear_interpolator"
android:toAlpha="0" />
</set>
這個代碼在java中
imageView.startAnimation(animace);
animace.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
imageView.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(Animation animation) {
imageView.setVisibility(View.INVISIBLE);
imageView.startAnimation(animace);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
你的標題是說一些關於**的run()**,但它不是在代碼中提到片斷你提供,請張貼完整代碼 – nobalG 2014-09-11 09:34:55
你是否在調用'imageView.setVisibility(View.VISIBLE)'''之前嘗試調用'imageView.setAlpha(0f);'onAnimationStart''? – Stanislav 2014-09-11 09:35:41
不,這不起作用,當設置alpha到imageview,然後imageview保持透明和動畫顯示什麼都沒有。 – 2014-09-11 09:51:14