简体   繁体   English

Android-如何在活动中将alertDialog动画实现为按钮

[英]Android - How to implement alertDialog animation dismiss into a button in activity

I'm trying to implement AlertDialog animation dismiss into a Button in Activity . 我正在尝试将AlertDialog动画实现到ActivityButton中。

And I found how to implement AlertDialog animation using Animation resource. 我发现了如何使用Animation资源实现AlertDialog动画。 ( http://android-er.blogspot.kr/2012/07/dialog-animation-using-windowanimations.html ) http://android-er.blogspot.kr/2012/07/dialog-animation-using-windowanimations.html


But I don't know how to dismiss into a button in activity like photos below. 但是我不知道如何在活动中像下面的照片那样变成按钮。

Thank you for your advice. 感谢您的意见。

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

    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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM