0
我一直在嘗試不同的方法來獲取與對象動畫師展開/合攏動畫,但他們迄今沒有工作。android objectanimator從上到下展開/摺疊動畫?
我已經使用this solution它可以工作,但是當我閱讀文檔時說它更喜歡用動畫工具來永久地爲物體而不是動畫製作動畫。
問題與我的代碼是,它始終從視圖的頂部開始,但我需要從底部展開/摺疊視圖。
這裏是我的代碼:
public boolean collapse(View view, int start, int end)
{
AnimatorSet set = new AnimatorSet();
ObjectAnimator a = ObjectAnimator.ofFloat(view, "translationY", start, end);
set.play(a);
set.setDuration(3000L);
set.setInterpolator(new LinearInterpolator());
set.addListener(new AnimatorListenerAdapter()
{
@Override
public void onAnimationEnd(Animator animation)
{
}
});
set.start();
return true;
}
謝謝,它的工作。雖然,屬性名稱應該寫成小寫「底部」。 –