検索

ホームページ  >  に質問  >  本文

Android属性动画如何指定旋转动画的基准点?

例如对ImageView进行旋转,使用补间动画可以很方便的指定ImageView的pivotX和pivotY,示例代码如下:

RotateAnimation animation = new RotateAnimation(fromDegrees, toDegrees, pivotX, pivotY);
animation.setDuration(100);
animation.setFillAfter(true);
mArrowImg.startAnimation(animation);

但是使用属性动画,目前我知道可以这样实现:

ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(
                mArrowImageView, "rotate", fromDegress, toDegress);
objectAnimator.setDuration(100);
objectAnimator.start();

但是ObjectAnimator怎么指定pivotX和pivotY呢?

大家讲道理大家讲道理2860日前968

全員に返信(1)返信します

  • 黄舟

    黄舟2017-04-17 17:52:04

    リーリー

    はすべて View を基準とした相対座標です。

    返事
    0
  • キャンセル返事