1
我正在嘗試按順序動畫3翻譯動畫。我基本上希望我的對話框片段從屏幕的底部移動到頂部,然後在到達屏幕頂部後稍微向下移動,然後再移動到頂部。這是我做的:順序翻譯動畫無法按預期工作
slide_bottom_in.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="300"
android:fromYDelta="100%p"
android:toYDelta="0"/>
<translate
android:startOffset="300"
android:duration="300"
android:fromYDelta="0"
android:toYDelta="10%p"/>
<translate
android:startOffset="600"
android:duration="300"
android:fromYDelta="10%p"
android:toYDelta="0"/>
</set>
和onCreateView()我DialogFragment的方法,我設置:
getDialog().getWindow().getAttributes().windowAnimations = R.style.dialogAnimation;
,這裏是我的styles.xml文件中dialogAnimation
<style name="dialogAnimation">
<item name="android:windowEnterAnimation">@anim/slide_bottom_in</item>
<item name="android:windowExitAnimation">@anim/slide_top_out</item>
</style>
但是這不起作用,因爲我預期。首先,它向上移動,但沒有達到頁面頂部,然後它再次向下移動,但仍不能達到預期的頂部。動畫結束後,片段立即移動到頂部(沒有動畫g)。任何關於什麼可能是我的xml錯誤的想法?
謝謝。