abstract Popwindow animation effects by setanimationstyle (int animationstyle) function android:windowenteranimation to enter window animation Android : Windowexitanimation indicates that the window exits the animation in the Res/values/style.xml code:? xml version= "1.0" encoding= "Utf-8"? Resources style
Popwindow animating effects with setanimationstyle (int animationstyle) function
Android:windowenteranimation to enter the window animation
Android:windowexitanimation indicates that the window exits the animation
In the Res/values/style.xml code:
[HTML]View Plaincopy
- <? XML version= "1.0"encoding= "Utf-8"?>
- <resources>
- <style name= "popupanimation"parent= "android:animation"mce_bogus="1">
- <item name="android:windowenteranimation"> @anim/popup_enter</Item>
- <item name="android:windowexitanimation"> @anim/popup_exit</Item >
- </style>
- </Resources>
In the Res/anim/popup_enter.xml declaration required to enter the animation
[HTML]View Plaincopy
- <? XML version= "1.0"encoding= "Utf-8"?>
- <set xmlns:android="http://schemas.android.com/apk/res/android">
- <scale android:fromxscale= "0.6"Android: toxscale="1.0"
- android:fromyscale= "0.6"Android: toyscale= "1.0"android:p ivotx="50% "
- android:pivoty= "50%"android:d uration="$"/>
- <Alpha android:interpolator="@android: Anim/decelerate_interpolator"
- android:fromalpha= "0.0"Android: toalpha= "1.0"android:d uration="$"/>
- </Set>
Exit animation required in Res/anim/popup_exit.xml declaration
[HTML]View Plaincopy
- <? XML version= "1.0"encoding= "Utf-8"?>
- <set xmlns:android="http://schemas.android.com/apk/res/android">
- < scale
- android:fromxscale="1.0"
- android:toxscale="0.5"
- android:fromyscale="1.0"
- android:toyscale="0.5"
- android:pivotx="50%"
- android:pivoty="50%"
- android:duration="/> "
- <Alpha
- android:interpolator="@android: Anim/accelerate_interpolator"
- android:fromalpha="1.0"
- android:toalpha="0.0"
- android:duration="/> "
- </Set>
Setting the location and animation of Popwindow
Popupwindow.setanimationstyle (r.style.popupanimation);
Popupwindow.showatlocation (Findviewbyid (r.id.parent), gravity.center| Gravity.center, 0, 0);
Popupwindow.update ();
Call Popupwindow.dismiss (); statement. Popwindow disappears, auto-call disappears animation popup_exit.xml
http://blog.csdn.net/heng615975867/article/details/8893655