animation - how to rotate an imageview in android on center point -


I wanted to keep the image point rotated with one point (ex: 5 seconds). Is this possible? how?

Like this picture:

Enter image details here

  public class RotateImageView ImageView extended {private animation mRotation; Public = bull = express; False; Public RotateImageView (Reference Reference) {Super (Reference); Init (zero); } Public RotateImageView (Reference Reference, AttributeSet attrs) {super (references, attrs); Init (attrs); } @TargetApi (Build.VERSION_CODES.HONEYCOMB) Public RotateImageView (context reference, AttributeSet attrs, int defStyle) {super (references, attrs, defStyle); Init (attrs); } Private Zero Init (AttributeSet attrs) {startAnimation (); } Public Zero Start Subscription () {if (mRotation == faucet) {mRotation = AnimationUtils.loadAnimation (getContext (), R. Anime. Arotate); MRotation.setRepeatCount (Animation.INFINITE); } This.startAnimation (mRotation); IsAnimating = true; } Public Zero Stop Animation () {If (mRotation! = Null) clearAnimation (); IsEnimating = false; } @ Override Public Zero Set Visibility (if Visibility == Jean · Visibility == INVISIBLE) {Clear animation (); } And if (visibility == visual) {startAnimation (mRotation); } Super. Set visibility (visibility); }  

}

rotate.xml

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Android: FromDegrees = "0" Android: Interpolator = "@Android: Anime / Liner_Interpolator" Android: Route xmlns: Android = "http://schemas.android.com/apk/res/android" Android: Period = "5000" Android: PivotX = "50%" Android: pivotY = "50%" Android: startoffset = "0" Android: toDegrees = "360" />  

edit

  rotate image = new rotate view (context); Image.addOnClickListener (New View.OnClickListener () (if image.isAnimating) image.stopAnimating (); else image.startAnimating ();}  

Comments