He estado rastreando la mayor cantidad de temas sobre este tema que puedo encontrar en el parpadeo que aparece en Android 2.2 cuando trato con AnimationListeners, pero no puedo resolver mi problema.Android Animation Flicker
Lo que tengo es un "popover" LinearLayout que el usuario toca para bajar unos 100 píxeles, y toca de nuevo para volver a subirlo. Finalmente lo tengo trabajando en la primera parte sin ningún parpadeo (gracias a la sugerencia de llamar a clearAnimation() en la vista que se anima), pero al hacer lo contrario (es decir, mover la vista hacia atrás), hay un parpadeo en el comienzo. Realmente no puedo llamar a clearAnimation() en el método onAnimationStart() ya que no se animará.
Por supuesto, todas las animaciones funcionan perfectamente si utilicé setFillAfter() sin ningún oyente de animación, pero el área táctil de la vista no se moverá (porque la vista en sí no se ha movido).
Cualquier ayuda sería muy apreciada.
this.popoverTab.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
popoverTab.setClickable(false);
popoverTab.setFocusable(false);
if (popoverHidden) {
Log.d(TAG, "About to show popover");
// the popover is currently hidden, show it.
TranslateAnimation animation = new TranslateAnimation(0, 0, 100, 0);
animation.setDuration(700);
animation.setFillBefore(true);
animation.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(Animation animation) {
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationStart(Animation animation) {
footer.layout(footer.getLeft(), (footer.getTop() - 100), footer.getRight(), footer.getBottom());
}
});
footer.startAnimation(animation);
} else {
Log.d(TAG, "About to hide popover");
// the popover is showing, hide it.
TranslateAnimation animation = new TranslateAnimation(0, 0, 0, 100);
animation.setDuration(700);
animation.setFillAfter(true);
animation.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(Animation animation) {
footer.clearAnimation();
footer.layout(footer.getLeft(), (footer.getTop() + 100), footer.getRight(), footer.getBottom());
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationStart(Animation animation) {
}
});
footer.startAnimation(animation);
}
// invert.
popoverHidden = !popoverHidden;
popoverTab.setClickable(true);
popoverTab.setFocusable(true);
}
});
Esto debe marcarse como la respuesta. +1 –
¡Muchas gracias por resolver este problema! –
Muchas gracias. Me llevó demasiado tiempo para encontrar esto. – braden