Mam ViewFlipper, który uruchamia animację widoku po wywołaniu showPrevious. Animacja działa dobrze. Ale problem zaczyna się od opóźnienia ponad 1 sekundy. Teraz to nie wydaje się dużo, ale poważnie opóźnia korzystanie z aplikacji.ViewFlipper o "dużym" opóźnieniu
Moje animacje wyglądają tak;
Animation inFromLeft = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, -1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
inFromLeft.setDuration(350);
inFromLeft.setInterpolator(new LinearInterpolator());
Animation outtoRight = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, +1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
outtoRight.setDuration(350);
outtoRight.setInterpolator(new LinearInterpolator());
ustawić animacje za pomocą setInAnimation
i setOutAnimation
;
setInAnimation(inFromLeft);
setOutAnimation(outtoRight);
A potem po prostu uruchomić animację używając showPrevious
Czy jest jakiś powód, animacje zaczyna z opóźnieniem ponad 1 sekund, startTime dla animacji jest -1 i startOffset 0.
Rozwiązaniem było przejście do ViewPagera, animacja nie jest dokładnie tą, którą chciałem, ale opóźnienie zniknęło. Zmiana animacji na XML nie zmieniła niczego. – Thys