I can't provide the code for the moment I'll update the question in the nearest future, but I'll explain the situation and you can tell me what to check first of all.
I have a Gallery
with a set of ImageViews
.
When ImageView
is selected, view.startAnimation(grow);
is cast. Everything works perfect.
Then I tap (onTouchEvent
starts another animation on the unselected view: view.startAnimation(decrease);
)
Everything works fine on the first element.
But when I choose the next imageview, grow animation works fine aswell, but decrease animation works on both of the imageViews. So it seems that startAnimation method runs the animation on all the imageViews that were choosen previously.
I had no luck finding the same question on stackoverflow. Will be very appreciate if you give me some ideas.
It may help someone. Finally I've found the solution.
I have 2 methods:
animationShow(View view) {
View.startAnimation(animationShow);
}
and
animationHide(View view) {
View.startAnimation(animationHide);
}
I also have 2 views to work with: currently selected view (selectedView
) and previously selected view (prevView
), so I hide animation on prevView and show it on selectedView.
To avoid gallery issue with hiding animation, I changed animationShow()
method:
animationShow(View view) {
View.startAnimation(animationShow);
if (prevView != null) {
prevView.cancelAnimation();
}
}
When new item is selected (and old item was hidden) I just cancel all the animations on the prevView. It helped me. Hope it will help someone else.