Android 如何使用属性动画围绕点旋转视图?

Android 如何使用属性动画围绕点旋转视图?,android,animation,Android,Animation,使用Tween动画code: @Override public void onClick(View v) { RotateAnimation rotateAnimation = new RotateAnimation (0,90,Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,0); rotateAnimation.setDuration (2000); rotateAnimation.setFillAf

使用
Tween动画
code:

 @Override
 public void onClick(View v) {
    RotateAnimation rotateAnimation = new RotateAnimation (0,90,Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,0);
    rotateAnimation.setDuration (2000);
    rotateAnimation.setFillAfter (true);
    image2.startAnimation (rotateAnimation);
}  
当然,使用
Tween动画
可以做到这一点,但
Tween动画
有缺陷。
例如,以下gif单击事件不会移动。 所以我想使用
属性动画
来实现这一点,但我发现
属性动画
只能围绕中心旋转。
如何使用属性动画围绕点旋转视图?

从你的问题来看,我认为你需要围绕鼠标指针旋转

试试这个,我想应该有用,但我还没有机会试试

...
Animation rotateAnimation  = new RotateAnimation(0.0f, 360.0f,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
                0.0f);
...