百度了一下补间动画的旋转动画,发现都是绕自身做圆周运动的,根本就不符合自己的项目需求:绕父控件的中点做圆周运动。后来只能去其他地方查资料,实现自己想要的效果,其实实现起来很简单,下面上代码:
private void rotateAnimation(){;
RotateAnimation rotate = new RotateAnimation(0f,360f,RotateAnimation.RELATIVE_TO_SELF,0.5f,
RotateAnimation.RELATIVE_TO_PARENT,0.5f);
rotate.setInterpolator(new LinearInterpolator());
rotate.setDuration(10000);
rotate.setRepeatCount(0);
img_point.startAnimation(rotate);
}
就是x轴和y轴的坐标点参照的对象RotateAnimation.RELATIVE_TO_SELF和RotateAnimation.RELATIVE_TO_PAREN;
其实一开始我的x轴和y轴设置的参照对象都是RotateAnimation.RELATIVE_TO_PAREN,发现并不是以父控件的中心旋转,只有把
x轴的参照对象改为RotateAnimation.RELATIVE_TO_SELF才可以染中点旋转。
不知道为什么要这么改,求有知道的大神告知