Slide transition animation in a ActivityGroup on Android

后端 未结 1 1573
無奈伤痛
無奈伤痛 2021-02-06 19:17

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

publ         


        
相关标签:
1条回答
  • 2021-02-06 19:55

    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);
    }
    
    0 讨论(0)
提交回复
热议问题