<activity
Android:name= ". Myorderlistserviceactivity "
Android:theme= "@style/mytheme"
>
In the Style.xml file of the values of the declaration of a style, named MyTheme, notice that there is something I customize, related to the declaration of animation, only <item name= "Android:windowanimationstyle" > @style/animationactivity</item> this one.
<style name= "MyTheme" >
<!--Float_box for us to define the window background--
<item name= "android:backgrounddimenabled" >true</item>
<item name= "Android:windowframe" > @null </item>
<item name= "Android:windowbackground" > @android:color/transparent</item>
<item name= "Android:windowistranslucent" >true</item>
<item name= "Android:windowcontentoverlay" > @null </item>
<item name= "Android:windownotitle" >true</item>
<item name= "Android:windowfullscreen" >true</item>
<item name= "Android:windowanimationstyle" > @style/animationactivity</item>
</style>
In the Style.xml file of the values of the declaration of a style, named Animationactivity, yes is the above mytheme in the implementation of the Windowanimationstyle, as follows:
<style name= "Animationactivity" mce_bogus= "1" parent= "@android: Style/animation.activity" >
<item name= "Android:activityopenenteranimation" > @anim/slide_in_bottom</item>
<item name= "Android:activityopenexitanimation" > @anim/slide_out_bottom</item>
<item name= "Android:activitycloseenteranimation" > @anim/slide_in_bottom</item>
<item name= "Android:activitycloseexitanimation" > @anim/slide_out_bottom</item>
</style>
Add the above content, some machines although the animation is available, but the exit animation is not valid, but also need to add some code in your activity, to ensure the perfect operation of animation
Add Global variables
protected int activitycloseenteranimation;
protected int Activitycloseexitanimation
Add the following code to the OnCreate:
TypedArray Activitystyle = Gettheme (). Obtainstyledattributes (New int[] {Android. R.attr.windowanimationstyle});
int windowanimationstyleresid = Activitystyle.getresourceid (0, 0);
Activitystyle.recycle ();
Activitystyle = Gettheme (). Obtainstyledattributes (Windowanimationstyleresid, new int[] {Android. R.attr.activitycloseenteranimation, Android. R.attr.activitycloseexitanimation});
activitycloseenteranimation = Activitystyle.getresourceid (0, 0);
Activitycloseexitanimation = Activitystyle.getresourceid (1, 0);
Activitystyle.recycle ();
Before you finish the program, you need to call the following code:
Overridependingtransition (Activitycloseenteranimation, activitycloseexitanimation);
The example I call is as follows:
@Override
public void Finish () {
LOG.I (TAG, "Finish");
Super.finish ();
Overridependingtransition (Activitycloseenteranimation, activitycloseexitanimation);
}
That's all you can do.
Android style exit animation resolves exiting animation invalid issue