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. 对话框动画问题
- 2. jQuery UI对话框 - 动画
- 3. AsyncTask动画对话框
- 4. Android - 带弹跳效果的动画弹出对话框
- 5. 带动态内容的jQuery对话框
- 6. jQuery对话框 - 从中心移动到右上角的动画对话框
- 7. RecyclerView onBindviewholder对话框clicklistner动画
- 8. 动画与对话框片段Android
- 9. 自定义进度对话框动画
- 10. Javascript对话框动画 - 最终调整
- 11. GWT对话框 - 当动画启用
- 12. 将活动内容带到对话框
- 13. 带有SDL的对话框/消息框?
- 14. 从服务启动的Android对话框不运行动画
- 15. 动态对话框
- 16. Spritesheet动画带有刻度的框架
- 17. 带有标签的jQuery UI对话框
- 18. 带有PIN输入的Android对话框
- 19. 带聚焦textField的QML对话框
- 20. 带iframe的Jquery模式对话框
- 21. 带多个按钮的Javascript对话框
- 22. 带有jQuery-Mobile的对话框插件
- 23. 带有Button和ImageView的对话框?
- 24. 带对话框的jQuery验证
- 25. JQuery UI(带有Javascript的对话框)
- 26. 带对话框的时间选取器
- 27. 带有EditText的TextView打开对话框
- 28. 带后退按钮的WebView对话框
- 29. 带确认的jQuery UI对话框
- 30. 带确认对话框的JFileChooser
从这里开始:https://developer.android.com/training/transitions/overview.html –