【发布时间】:2020-07-16 17:15:39
【问题描述】:
美好的一天。
如果可能的话,我将不胜感激。
下面的代码非常适合将 imageView 移动到 x = 200 和 y = 100。在此移动之后,ImageView 围绕中心 (0,0) 位置旋转 360 度。
如何在 X = 200 和 Y = 100 时设置 pivotX 和 pivotY 值?
提前谢谢你。
保罗
public void onButtonClickRotate(View v) {
ObjectAnimator animatorX = ObjectAnimator.ofFloat(imageView, "translationX", 200f);
ObjectAnimator animatorY = ObjectAnimator.ofFloat(imageView, "translationY", 100f)
.setDuration(100);
ObjectAnimator rotation = ObjectAnimator.ofFloat(imageView,"rotation", 0f, 360f)
.setDuration(1000);
AnimatorSet set = new AnimatorSet();
set.playSequentially(animatorX, animatorY,rotation);
set.setDuration(2000);
set.start();
}
}
【问题讨论】: