0
Q
帶動畫的對話框
A
回答
0
我用下面的動畫來實現類似的東西.. slide_up.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="600"
android:fromXScale="0.6"
android:fromYScale="0.5"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.0"
android:toYScale="1.0" />
<translate
android:duration="600"
android:fromYDelta="22%"
android:toYDelta="0%" />
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="600"
android:fillAfter="true"
android:fromAlpha="0.0"
android:toAlpha="1.0" />
</set>
slide_down.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="600"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="0.6"
android:toYScale="0.5" />
<translate
android:duration="600"
android:fromYDelta="0%"
android:toYDelta="26%" />
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="600"
android:fillAfter="true"
android:fromAlpha="1.0"
android:toAlpha="0" />
</set>
您可以根據您的需要改變pivotX和pivotY。 style.xml
<style name="DialogTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:background">@color/transparent</item>
<item name="android:windowEnterAnimation">@anim/slide_up</item>
<item name="android:windowExitAnimation">@anim/slide_down</item>
</style>
在對話框寫
dialog.getWindow().getAttributes().windowAnimations = R.style.DialogTheme;
希望這有助於!
相關問題
- 1. AsyncTask動畫對話框
- 2. jQuery UI對話框 - 動畫
- 3. 動畫完成對話框
- 4. 對話框動畫問題
- 5. Android - 帶彈跳效果的動畫彈出對話框
- 6. 帶翻轉動畫的GWT模態對話框(如效果庫)
- 7. 關閉對話框片段的動畫
- 8. 動畫調整jQuery UI的對話框
- 9. 帶動態內容的jQuery對話框
- 10. jQuery對話框 - 從中心移動到右上角的動畫對話框
- 11. 帶DataTable的JQuery對話框()
- 12. 道場對話框onEnd()動畫例外
- 13. GWT對話框 - 當動畫啓用
- 14. 關閉Android對話框動畫
- 15. 自定義進度對話框動畫
- 16. RecyclerView onBindviewholder對話框clicklistner動畫
- 17. Javascript對話框動畫 - 最終調整
- 18. 動畫與對話框片段Android
- 19. 將活動內容帶到對話框
- 20. 不帶對話框自動打印
- 21. 帶對話框的自定義進度條對話框框架
- 22. 帶有SDL的對話框/消息框?
- 23. 帶黑莓文本框的對話框
- 24. 使用框架動畫的自定義進度對話框
- 25. 動畫jQuery UI的對話框自動調整
- 26. 從服務啓動的Android對話框不運行動畫
- 27. 在對話框中自動啓動可繪製動畫片段
- 28. 動態對話框
- 29. Spritesheet動畫帶有刻度的框架
- 30. 帶有標籤的jQuery UI對話框
從這裏開始:https://developer.android.com/training/transitions/overview.html –