Problem scenario: How do I get the activity to enter from the lower left corner and then press one of the buttons to exit to the lower left corner?
1. How animations are invoked.
There are 2 different ways. One is to specify the activity's theme in the XML file, and the second is to call overridependingtransition (int enteranim, int exitanim) after the startactivity and finish functions;
Since the activity's theme in my code has been specified, the second method is selected
2. Animations.
Using two animations, the key code specified in the lower left corner is android:pivotx=15%, android:pivoty=95%.
The code is as follows:
activity into animation
<Setxmlns:android= "Http://schemas.android.com/apk/res/android"> <Alphaandroid:duration= "+"Android:fromalpha= "0"Android:toalpha= "1.0" /> < Scaleandroid:duration= "+"Android:fromxscale= "0"Android:fromyscale= "0"Android:pivotx= "15%"Android:pivoty= "95%"Android:toxscale= "1.0"Android:toyscale= "1.0" /></Set>
activity exit animation
<Setxmlns:android= "Http://schemas.android.com/apk/res/android"> <Alphaandroid:duration= "+"Android:fromalpha= "1.0"Android:toalpha= "0" /> < Scaleandroid:duration= "+"Android:fromxscale= "1.0"Android:fromyscale= "1.0"Android:pivotx= "15%"Android:pivoty= "95%"Android:toxscale= "0"Android:toyscale= "0" /></Set>
3. Attention Points
overridependingtransition (int enteranim, int exitanim) was called after StartActivity, and no animation was found when exiting. The workaround is to also call overridependingtransition (int enteranim, int exitanim) after the finish function.
Repeated calls two times, feeling as if they were assigned to enter the animation and exit animation.
Android Activity Animation Call mode