質問

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