簡體   English   中英

Android-如何在活動中將alertDialog動畫實現為按鈕

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

我正在嘗試將AlertDialog動畫實現到ActivityButton中。

我發現了如何使用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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM