Wszystkim,Android klatki animacji z AnimationDrawable zatrzymuje się przy użyciu środka TranslateAnimation
Mam animowany obraz z animacji ramki, która ruszam się z tyłu i widok na ekranie. Kiedy program TranslateAnimation jest gotowy, chcę zachować pozycję mety, aby setFillAfter był ustawiony na true.
Moim problemem jest to, że animacja klatki jest zatrzymywana po zakończeniu translacji. Jak mogę uruchomić lub kontynuować animację klatek?
<?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);
Czy możesz pokazać animację klatki xml? –
Zaktualizowano pytanie za pomocą animacji klatek xml. – Koppo
Jedyne co zauważyłem po dotknięciu ekranu Widzę, że animacja zaczyna się tak długo, jak długo dotykam ekranu. Zatrzymuje się, gdy zdejmuję z niego rękę. – Koppo