2011-08-17 87 views

回答

8

值窗口\風格.XML

<resources> 
<style name="AnimationPopup"> 
    <item name="@android:windowEnterAnimation">@anim/appear</item> 
    <item name="@android:windowExitAnimation">@anim/disappear</item> 
</style> 
</resources> 

動畫\ appear.xml

<set xmlns:android="http://schemas.android.com/apk/res/android" 
android:shareInterpolator="false" > 

<scale 
    android:duration="1000" 
    android:fillAfter="false" 
    android:fromXScale="0.0" 
    android:fromYScale="0.0" 
    android:interpolator="@android:anim/accelerate_decelerate_interpolator" 
    android:pivotX="50%" 
    android:pivotY="90%" 
    android:toXScale="1.0" 
    android:toYScale="1.0" /> 
</set> 

動畫\ disappear.xml

<set xmlns:android="http://schemas.android.com/apk/res/android" 
android:shareInterpolator="false" > 

<scale 
    android:duration="1000" 
    android:fillAfter="false" 
    android:fromXScale="1.0" 
    android:fromYScale="1.0" 
    android:interpolator="@android:anim/accelerate_interpolator" 
    android:pivotX="50%" 
    android:pivotY="90%" 
    android:toXScale="0.0" 
    android:toYScale="0.0" /> 
</set> 
4

使用這種XMLS從底部轉換到頂部,反之亦然。

動畫\ pull_in.xml

<set xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shareInterpolator="false" > 
    <translate 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:duration="@android:integer/config_longAnimTime" 
     android:fromYDelta="100%" 
     android:toYDelta="0%" /> 
</set> 

動畫\ pull_out.xml

<set xmlns:android="http://schemas.android.com/apk/res/android" 
android:shareInterpolator="false" > 
    <translate 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:duration="@android:integer/config_longAnimTime" 
     android:fromYDelta="0%" 
     android:toYDelta="100%" /> 
</set> 
相關問題