He imagen animada con animaciones de cuadros que estoy en movimiento desde detrás de una vista y en la pantalla. Cuando finalice la Animación de traducción, quiero mantener la posición de finalización para que setFillAfter se establezca en verdadero.
Mi problema es que la animación de cuadro se detiene cuando finaliza la traducción de TranslateAnimation. ¿Cómo puedo reiniciar o mantener activada la animación de cuadros?
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
id="selected" android:oneshot="false">
<item android:drawable="@drawable/a" android:duration="200" />
<item android:drawable="@drawable/b" android:duration="200" />
<item android:drawable="@drawable/c" android:duration="200" />
</animation-list>
loadingView = (RelativeLayout) findViewById(R.id.loadingBar);
loadingView.setVisibility(View.VISIBLE);
loadingImage = (ImageView) loadingView.findViewById(R.id.loading);
loadingImage.setBackgroundResource(R.drawable.loading);
animateImages = (AnimationDrawable) loadingImage.getBackground();
translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF,0.0f, Animation.RELATIVE_TO_SELF, -1.0f);
translateAnimation.setInterpolator(new AccelerateInterpolator());
translateAnimation.setDuration(2000);
translateAnimation.setFillEnabled(true);
translateAnimation.setFillAfter(true);
translateAnimation.setAnimationListener(new AnimationListener()
{
@Override
public void onAnimationStart(Animation animation)
{
// TODO Auto-generated method stub
animateImages.start();
}
@Override
public void onAnimationEnd(Animation arg0)
{
}
@Override
public void onAnimationRepeat(Animation animation)
{
// TODO Auto-generated method stub
}
});
loadingView.startAnimation(translateAnimation);
¿Puedes mostrar tu animación de cuadro xml? –
Actualizó la pregunta con la animación de cuadro xml. – Koppo
La única otra cosa que noté cuando toqué la pantalla, veo que la animación comienza mientras estoy tocando la pantalla. Se detiene cuando le quito la mano. – Koppo