Question

So the following animation works as expected:

Animation scaleUp = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    scaleUp.setDuration(1000);

Sadly, this one doesn't:

Animation scaleDown = new ScaleAnimation(2, 1, 2, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    scaleUp.setDuration(2000);

The view that has the scaleDown animation simply waits 2 seconds then suddenly appears. I can't figure out why scaleUp works but scaleDown doesn't.

Scale animation DOES work with fromX and fromY values greater than 1 correct? I couldn't find any documentation to say otherwise.

Était-ce utile?

La solution

Issue is that , your have set the scale down duration to scaleUp and not scaleDown.

change it as below..

Animation scaleDown = new ScaleAnimation(2, 1, 2, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
scaleDown.setDuration(2000);
imageView.setAnimation(scaleDown);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top