Code example for RotateAnimation

Methods: setAnimationListener, setDuration

0
	 * @param durationMillis 持续时间 
	 * @param animationListener 动画监听器 
	 * @return 一个旋转动画 
	 */ 
	public static RotateAnimation getRotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue, long durationMillis, AnimationListener animationListener){
		RotateAnimation rotateAnimation = new RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue);
		rotateAnimation.setDuration(durationMillis);
		if(animationListener != null){
			rotateAnimation.setAnimationListener(animationListener);
		} 
		return rotateAnimation;
	} 
	 
	/** 
	 * 获取一个根据视图自身中心点旋转的动画 
	 * @param durationMillis 动画持续时间 
	 * @param animationListener 动画监听器 
	 * @return 一个根据中心点旋转的动画 
	 */ 
	public static RotateAnimation getRotateAnimationByCenter(long durationMillis, AnimationListener animationListener){
		return getRotateAnimation(0f, 359f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f, durationMillis, animationListener);