1
我想動畫片段過渡,它在我在setCustomAnimations
的xml中使用objectAnimator時有效,但我需要在運行時設置開始和結束位置,因此在搜索後我發現我可以覆蓋onCreateAnimator
並返回一個自定義動畫師。沒有xml的自定義片段動畫
我可能錯過了一些東西,但設置爲動畫製作者的目標是什麼?
@Override
public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) {
ObjectAnimator animator = ObjectAnimator.ofFloat(???, "y", 2392.0f, 2300.0f);
return animator;
}
我看到設置像這樣
ObjectAnimator animator = ObjectAnimator.ofFloat(this, "y", 2392.0f, 2300.0f);
的例子,但然後我得到的消息是沒有SETY方法(這是有道理的,因爲它在尋找它的片段)
我試圖設置View
膨脹在onCreateView
作爲目標,但沒有幫助。
Docs對這種方法有點缺乏,所以任何幫助都會很大。
感謝