Slide transition animation in a ActivityGroup on A

2019-03-17 01:04发布

I want to add slide transition animation while changing activities within a ActivityGroup. I have used following function to change activities using intent:

public void replaceContentView(String id, Intent newIntent) {
    View view = getLocalActivityManager().startActivity(id,
            newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
            .getDecorView();
    history.add(view);
    this.setContentView(view);
}

Any suggestion how can I do that?

1条回答
等我变得足够好
2楼-- · 2019-03-17 01:35

add animation to the view

Example

public void replaceContentView(String id, Intent newIntent) {
    View view = getLocalActivityManager().startActivity(id,
            newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
            .getDecorView();

Animation hyperspaceJump = 
     AnimationUtils.loadAnimation(this, R.anim.myanimation);
    view.startAnimation(hyperspaceJump);
 history.add(view);
    this.setContentView(view);
}
查看更多
登录 后发表回答