Android view animation stops when view out of screen



I'm having a recyclerView with several views and one is the animation view which has an animation applied to it. Once the view is out of the screen the animation is no longer active, even though the animation still exists.


The data:


rotate_around_center_point.xml



<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://ift.tt/nIICcg"
android:shareInterpolator="false" >

<rotate
android:duration="2500"
android:interpolator="@android:anim/linear_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:repeatMode="restart"
android:toDegrees="360" />

</set>


Applying animation:



animation = AnimationUtils.loadAnimation(this.getContext(),
R.anim.rotate_around_center_point);
loadingRotatingCircleIV.startAnimation(animation);


I could not find any way to catch an event when the animation is interrupted so I'm able to restart the animation once it was out of the screen.


No comments:

Post a Comment