调用 startActivity(Intent) 或者 finish() 退出当前 Activity 时,立刻调用下面方法,可以达到关闭动画效果的目的。
overridePendingTransition(0, 0);
overridePendingTransition
void overridePendingTransition (int enterAnim, int exitAnim)
Call immediately after one of the flavors of startActivity(Intent) or finish() to specify an explicit transition animation to perform next.
As of JELLY_BEAN an alternative to using this with starting activities is to supply the desired animation information through a ActivityOptions bundle to {@link #startActivity(Intent, Bundle) or a related function. This allows you to specify a custom animation even when starting an activity from outside the context of the current top activity.
Parameters | |
---|---|
enterAnim | int: A resource ID of the animation resource to use for the incoming activity. Use 0 for no animation. |
exitAnim | int: A resource ID of the animation resource to use for the outgoing activity. Use 0 for no animation. |
网友评论