2017-04-24 5 views
0

코드에 애니메이션이 있습니다. 하지만 Button을 클릭하면 ImageView가 원래 위치로 돌아갑니다 (애니메이션 재설정). 그 방법이 있습니다. 내 코드는 다음과 같습니다ImageView에서 지연된 애니메이션 삭제

private void returnToOriginalRotationState() { 
    RotateAnimation animation = new RotateAnimation(0.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f); 
    animation.setInterpolator(new LinearInterpolator()); 
    animation.setDuration((long) 2*1000); 
    animation.setFillAfter(true); 
    animation.setFillEnabled(true); 
    imgHeade.startAnimation() } 

그것은뿐만 아니라 작동 그러나 animation.setDuration() (긴 2 * 1000);

작동하지 않음 !!!

android-android-animation

+0

'imgHeade.setAnimation (animation);을 실행하고 애니메이션을 실행하십시오. – azizbekian

+0

감사합니다. imgHeade.setAnimation (애니메이션)을 사용했습니다. 하지만 애니메이션이 실행되고 있지 않습니다. –

답변

0

수행 할 애니메이션입니까?

new RotateAnimation(0.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f); 

모든 학위는 0.0f 인 것으로 보입니다.

+0

예, ImageView를 원래 위치에 놓고 싶습니다. 버튼 ImageView가 새로운 RotateAnimation으로 이동했기 때문에 (0,19, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0); 이 코드는 잘 작동합니다 –

+0

이제 ImageView를 원래 위치로 되돌리려합니다. –

+0

반환 애니메이션이 제대로 작동하려면 19 어딘가에 사용해야합니다. –

관련 문제