Android Story

[ Android ] 이미지 앵글 변경 및 애니메이션 ( 테스트 X )

WhiteDuck 2016. 5. 25. 18:08



앵글


Matrix matrix = new Matrix();
imageView.setScaleType(ImageView.ScaleType.MATRIX);   //required
matrix.postRotate((float) angle, pivotX, pivotY);
imageView.setImageMatrix(matrix);


애니메이션


public void turn()
{
    RotateAnimation anim = new RotateAnimation(currentRotation, currentRotation + 30,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f);
    currentRotation = (currentRotation + 30) % 360;

    anim.setInterpolator(new LinearInterpolator());
    anim.setDuration(1000);
    anim.setFillEnabled(true);

    anim.setFillAfter(true);
    turnImg.startAnimation(anim);
}


참고 :

http://stackoverflow.com/questions/8981845/android-rotate-image-in-imageview-by-an-angle

http://stackoverflow.com/questions/5928412/android-rotate-imageview-i-cant-set-the-final-position-of-imageview-in-onanimat

반응형