美文网首页
[Android] Activity 退出时不使用动画效果

[Android] Activity 退出时不使用动画效果

作者: du玩具 | 来源:发表于2017-07-06 10:50 被阅读0次

    调用 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.

    相关文章

      网友评论

          本文标题:[Android] Activity 退出时不使用动画效果

          本文链接:https://www.haomeiwen.com/subject/kfqhhxtx.html