How can I add an animation to the activity finish()

后端 未结 8 1829
清酒与你
清酒与你 2020-11-27 13:37

I\'m using overridePendingTransition for when my activity is created and that works fine I can see the fade in works great, but when I try and animate the finish on the acti

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 14:19

    Use startActivityForResult to start your child activity and in onActivityResult() of your parent activity:

        @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if(requestCode==REQUEST_YOUR_ACTIVITY) {
            overridePendingTransition(R.anim.parent_appearing_anim, R.anim.child_dissmissing_anim);
        }
        super.onActivityResult(requestCode, resultCode, arg2);
    }
    

提交回复
热议问题