Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rotate an Image pivot in the Center - Android

I want to rotate an Image pivoting in the center. I want to use this when i rotate the image I need to load dynamic Text as menu. Like a Jog. Any one pls help me for rotating an image

like image 864
Droidand Avatar asked Jun 14 '11 10:06

Droidand


1 Answers

To rotate an image you can do this:

RotateAnimation rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);

ImageView image = findViewById(my image);
image.setAnimation(rotate);

rotate.start();

This will rotate the image one round from 0 to 360 degrees. You can set the duration too:

rotate.setDuration( 500 ); // milliseconds
like image 194
Eric Nordvik Avatar answered Sep 22 '22 23:09

Eric Nordvik