Android : Android animation repeat

on Thursday, September 11, 2014


I have problem with animation in Android. Between End and Start of this animation blink on screen whole image with no alpha effect. Animation begin with alpha 0 and ends too with alpha 0. I have this code:



<?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>


and this code in 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) {
}
});

0 comments:

Post a Comment