[英]Android - How to implement alertDialog animation dismiss into a button in activity
我正在尝试将AlertDialog
动画实现到Activity
的Button
中。
我发现了如何使用Animation
资源实现AlertDialog
动画。 ( http://android-er.blogspot.kr/2012/07/dialog-animation-using-windowanimations.html )
但是我不知道如何在活动中像下面的照片那样变成按钮。
感谢您的意见。
set animation to dialog and also code in xml.
yourdialog.getWindow().getAttributes().windowAnimations = R.style.DAnimation;
put these in style.xml
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="DialogAnimation">
<item name="android:windowEnterAnimation">@android:anim/slide_in_left</item>
<item name="android:windowExitAnimation">@anim/slide_out_left</item>
</style>
<style name="DAnimation">
<item name="android:windowEnterAnimation">@anim/slide_in</item>
<item name="android:windowExitAnimation">@anim/slide_up</item>
</style>
<style name="saveanim">
<item name="android:windowEnterAnimation">@anim/slide_down</item>
<item name="android:windowExitAnimation">@anim/slide_top</item>
</style>
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
</resources>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.