I would like to do a scale animation on an image. When I click on it, it should be scaled up and it will be scaled down after clicking it again.
However, the image will be disappeared after it scale down.
Here's my code,
private void scaleAnimation() {
if (mIsViewExpanded) {
// collapse
ScaleAnimation scaleAnimation = new ScaleAnimation(1.25f, 1f, 1.25f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
scaleAnimation.setDuration(DELAY);
scaleAnimation.setFillAfter(true);
view.startAnimation(scaleAnimation);
} else {
// expand
ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 1.25f, 1f, 1.25f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
scaleAnimation.setDuration(DELAY);
scaleAnimation.setFillAfter(true);
view.startAnimation(scaleAnimation);
}
}
Do you guys have any idea? Thanks.