我想創建一個動畫,以便在我的滾動視圖中自動滾動。ObjectAnimator持續時間不被尊重
LinearLayout linearLayout = (LinearLayout) scrollView.getChildAt(0);
// linearLayout.getHeight() == 540
animScroll = ObjectAnimator.ofInt(scrollView, "scrollY", linearLayout.getHeight());
// animationDurationLong == 154000
animScroll.setDuration(animationDurationLong);
animScroll.setInterpolator(new LinearInterpolator());
animScroll.start();
我的動畫工作完美,我從我的滾動視圖內容到頂部到底部滾動,但我是96秒,而不是持續時間設定154秒。
有誰知道爲什麼?我檢查了我的手機的開發者設置,嘗試了兩種設備,仍然是同樣的問題。
ofInt'的'最後一個參數是錯誤的,你需要:'內容高度 - 容器height' – pskink
你是對的,謝謝pskink。你能發表答案,以便我回答你的答案嗎? – Aximem