Tengo un ScrollView en la ventana emergente. Estoy animando los contenidos de ScrollView usando TranslateAnimation.onAnimationEnd no se llama, onAnimationStart funciona bien
Cuando se inicia la animación, se llama al escucha onAnimationStart pero no se llama a onAnimationEnd. Algunas ideas ?
Diseño:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/popup_window_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:layout_width="@dimen/toolbar_padding_left"
android:layout_height="@dimen/toolbar_height"/>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+web/toolbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="none"
android:visibility="invisible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
...
</LinearLayout>
</ScrollView>
</LinearLayout>
código animación:
mToolbar = mPopupContents.findViewById(R.web.toolbar);
TranslateAnimation anim =
new TranslateAnimation(0, 0, -60, 0);
anim.setDuration(1000);
anim.setAnimationListener(new Animation.AnimationListener() {
public void onAnimationStart(Animation a) {
Log.d(LOGTAG, "---- animation start listener called" );
}
public void onAnimationRepeat(Animation a) {}
public void onAnimationEnd(Animation a) {
Log.d(LOGTAG, "---- animation end listener called" );
}
});
mToolbar.startAnimation(anim);
actualización: He verificado que el onAnimationEnd se llama pero se llama después de un cierto retraso (siempre y cuando no se inicia el nuevo animación durante ese tiempo).
El código ayudará. – Wroclai
@Viktor He actualizado la pregunta. – Karan
¿Puedes probar para definirlo dentro de un archivo XML y ver si está funcionando allí? – Wroclai