当FLAG_ACTIVITY_REORDER_TO_FRONT用于overridePendingTransition不起作用不起作用、FLAG_ACTIVITY_REORDER_TO_FRONT、ov

由网友(十年浮夸终成孤独患者??)分享简介:我在堆叠两项活动,以显示他们,我用FLAG_ACTIVITY_REORDER_TO_FRONT。到目前为止好,当我想要把活动使用overridePendingTransition动画的问题就来了。I have two activities in the stack, in order to show them I u...

我在堆叠两项活动,以显示他们,我用FLAG_ACTIVITY_REORDER_TO_FRONT。到目前为止好,当我想要把活动使用overridePendingTransition动画的问题就来了。

I have two activities in the stack, in order to show them I use FLAG_ACTIVITY_REORDER_TO_FRONT. So far so good, the problem comes when I want to bring the activity with an animation using overridePendingTransition.

Intent i = new Intent(ActivityA.this, ActivityB.class);
i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); 
ActivityA.this.startActivity(i);
overridePendingTransition(R.anim.transition_to_right, R.anim.transition_to_left);

的过渡未示出,但是,如果该标志没有被加入到意图(除去第2行)则没有问题。

The transition is not shown, however, if the flag is not added to the intent (removing line 2) then there is no problem.

是否有可能把一个活动前与动画?

Is it possible to bring an activity to front with an animation?

非常感谢!

推荐答案

我遇到了同样的问题。关键是要覆盖在onResume()回调的过渡。

I ran into this same problem. The trick is to override the transition in the onResume() callback.

@Override
public void onResume() {
    super.onResume();
    overridePendingTransition(R.anim.transition_to_right, R.anim.transition_to_left);
}
阅读全文

相关推荐

最新文章