Public voidoverridependingtransition(int enteranim, int exitanim)
Call immediately after one of the flavors of startActivity(Intent) or to finish() specify a explicit transition animation to perform next.
As of an alternative to using this with JELLY_BEAN starting activities are to supply the desired animation information through a ActivityOptions
bundle or a related function. This allows-specify a custom animation even when starting an activity from outside the context of the
Current top activity.
1. Swipe left and right
1.1 Right in and left out
Right_in.xml
<?XML version= "1.0" encoding= "Utf-8"?><Setxmlns:android= "Http://schemas.android.com/apk/res/android" > <Translateandroid:duration= "$"Android:fromxdelta= "100.0%p"Android:toxdelta= "0.0" /> <Alphaandroid:duration= "$"Android:fromalpha= "0.1"Android:toalpha= "1.0" /></Set>
Left_out.xml
<?XML version= "1.0" encoding= "Utf-8"?><Setxmlns:android= "Http://schemas.android.com/apk/res/android" > <Translateandroid:duration= "$"Android:fromxdelta= "0.0"Android:toxdelta= " -100.0%p" /> <Alphaandroid:duration= "$"Android:fromalpha= "1.0"Android:toalpha= "0.1" /></Set>
1.2 Left in right out
Left_in.xml
<?XML version= "1.0" encoding= "Utf-8"?><Setxmlns:android= "Http://schemas.android.com/apk/res/android" > <Translateandroid:duration= "$"Android:fromxdelta= " -100.0%p"Android:toxdelta= "0.0" /> <Alphaandroid:duration= "$"Android:fromalpha= "0.1"Android:toalpha= "1.0" /></Set>
Right_out.xml
<?XML version= "1.0" encoding= "Utf-8"?><Setxmlns:android= "Http://schemas.android.com/apk/res/android" > <Translateandroid:duration= "$"Android:fromxdelta= "0.0"Android:toxdelta= "100.0%p" /> <Alphaandroid:duration= "$"Android:fromalpha= "1.0"Android:toalpha= "0.1" /></Set>
2. Swipe up and down as well
3. About setting animation values
Http://developer.android.com/guide/topics/resources/animation-resource.html#Twee
<translate>
A vertical and/or horizontal motion. Supports the following attributes in any of the following three formats:
Values from-100 to ending with "%", indicating a percentage relative to itself;
Values from-100 to ending in "%p", indicating a percentage relative to its parent;
A float value with no suffix, indicating an absolute value.