问题
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:
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);
}
来源:https://stackoverflow.com/questions/6532678/slide-transition-animation-in-a-activitygroup-on-android