I have a ViewAnimator
(ViewSwitcher
to be precise) with fade in/out animations associated to it and two Views
which I transition between using the ViewAnimator.showNext()
and ViewAnimator.showPrevious()
methods.
There is a requirement in my app where sometimes I need to start straight from the second View
, without showing a fade animation in going from the first View
to the second. Anyone know if there is a straightforward way to accomplish this without having to mess around with the in/out animations associated to my ViewAnimator
?
Note: I have tried calling
ViewAnimator.setDisplayedChild(1)
but that also animates the transition.
I looked around and waited for a response but I'm guessing it's not possible. So, in the absence of a better solution, set your ViewAnimator
's in/out animations to null when you want to jump straight to a particular child View
of your ViewAnimator
, as follows:
myViewAnimator.setInAnimation(null);
myViewAnimator.setOutAnimation(null);
myViewAnimator.setDisplayedChild(childIndex);
If anyone knows a better way - rather than playing with the ViewAnimator
's in/out animations - please share!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With