1
我有4圖像視圖我想移動圖像1移動和縮放動畫的圖像2的位置。 [圖像動畫移動和縮放在一起
我已經嘗試了縮放
ObjectAnimator scaleX = ObjectAnimator.ofFloat(img1, "scaleX", (float) img2.getWidth());
ObjectAnimator scaleY = ObjectAnimator.ofFloat(img1, "scaleY", (float) img2.getHeight());
scaleX.setDuration(2000);
scaleY.setDuration(2000);
AnimatorSet scale = new AnimatorSet();
scale.play(scaleX).with(scaleY);
scale.start();
謝謝你r解決方案。但它不起作用。我剛剛檢查了文檔 - scale mean「設置視圖在x軸上的縮放量,作爲視圖未縮放寬度的一部分,值爲1意味着不應用縮放。」 – Anirban
那麼所有你需要的是scaleX()和scaleY()的其他值,例如scaleX(2)縮放爲原始大小的兩倍。 –
但是,我怎麼能給其他imageview高和寬的價值。 – Anirban