2012-03-18 4 views
3

원하는 방향의 화살표를 가리 키도록 이미지보기를 회전합니다. 다음 회전 (RotateAnimation 사용)을 수행하기 전에 ImageView의 현재 회전 한 각도를 어떻게 얻을 수 있습니까?Android ImageView : 어떻게 현재 회전 각도를 얻을 수 있습니까?

감사합니다.

+0

당신은 RotateAnimation은 [여기] 내 대답을 참조 확장하여이를 달성 할 수있다 [1] [1] : http://stackoverflow.com/questions/26139963/rotateanimation-get-current-angle/29168941 # 29168941 – rickul

답변

2

일부 변수에는 이전 회전 각도를 저장해야합니다.

0

저장 회전 각도 :

ImageView arrow = (ImageView) findViewById(R.id.arrow); 
    float x = arrow.getPivotX(); 
    float y = arrow.getPivotY(); 
    RotateAnimation anim = new RotateAnimation(arrowRotateStartAngle, arrowRotateXAngle, arrow.getWidth()/2, arrow.getHeight()/2); 
    anim.setFillAfter(true); 
    anim.setDuration(1000); 
    arrow.startAnimation(anim); 

    temRotate = arrowRotateStartAngle; 
    arrowRotateStartAngle = arrowRotateXAngle; 
    arrowRotateXAngle = temRotate; 
관련 문제