我改變的形象圖的左邊空白處按以下方式留有餘量。任何線索?更改Android使用動畫
我試了一下:
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat (image , "x" , VALUE);
objectAnimator.start();
這完美的作品,作爲圖像移動到動畫指定的X值,無論其layoutParams.leftMargin的值保持不變!所以我不能使用這種方法,因爲如果我嘗試使用值爲100的objectAnimator將值layoutParams.leftMargin更改爲100,則應用的值不正確(應用了200而不是100,效果如果objectAnimator仍然eventhough我設置左邊距以下方式:
layoutParams.leftMargin = 100;
謝謝你指點我在正確的方向! :) – Leeeeeeelo
不要忘記設置持續時間,我有一些問題,直到我設置持續時間:'a.setDuration(duration);' –
當我嘗試使用params.leftMargin時出現錯誤。顯然這不是一個領域 – Soroush