I have the following ViewAnimator
<ViewAnimator
android:padding="12dp"
android:id="@+id/view_animator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateFirstView="true">
<include
android:id="@+id/setup_password_select_type"
layout="@layout/setup_password_select_type" />
<include
android:id="@+id/setup_password_pattern"
layout="@layout/setup_password_pattern" />
<include
android:id="@+id/setup_password_pincode"
layout="@layout/setup_password_pincode" />
</ViewAnimator>
I perform animation in the following way.
viewAnimator.setInAnimation(slideInRightFast);
viewAnimator.setOutAnimation(slideOutLeftSlow);
viewAnimator.setDisplayedChild(1);
I was wondering, how can I listen to end of animation event?
I tried to use
this.viewAnimator.setLayoutAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
android.util.Log.i("CHEOK", "Animation end -> " + viewAnimator.getDisplayedChild());
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
But the above is not working.
I guess you want to listen animation child of
ViewAnimator
, if I'm right:Your code are listening animation of
ViewGroup
in this case isViewAnimator
but not it's childTry this solution if you need:
Wish it can help you. Sorry my bad English.