Android - 如何实现alertDialog动画解除活动中的按钮

时间:2014-01-22 09:28:24

标签: android animation

我正在尝试将AlertDialog动画解散实施到Button中的Activity

我找到了如何使用AlertDialog资源实现Animation动画。 (http://android-er.blogspot.kr/2012/07/dialog-animation-using-windowanimations.html


但是我不知道如何在下面的照片中点击按钮。

感谢您的建议。

enter image description here

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

    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>