문제

i want to rotate the image of imageView, i have scaled the image using matrix but having problem in rotation, i'm using the code...

int previousDegrees = 0;
        int degrees = 90;
        RotateAnimation animation = new RotateAnimation(previousDegrees,degrees,160,160);
        ImageView imageView = (ImageView)findViewById(R.id.imageView);
        animation.setDuration(1000);//Set the duration of the animation to 1 sec.
        imageView.startAnimation(animation);

it rotates the image for a second and setback to original position.. is there any way that image could rotate onclick continuosly.. like on (0,90.180.270,360)degrees... Any Help please!!!

도움이 되었습니까?

해결책

Set these parameters like so:

    animation.setFillEnabled(true);
    animation.setFillAfter(true);

From Android Developers Reference:

If fillAfter is true, the transformation that this animation performed will persist when it is finished.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top