Reputation: 8724
Is there any way to override the pending transition by passing it actual Animation object instead of an ID to an animation resource?
From
startActivity(intent);
overridePendingTransition(R.anim.fadein, R.anim.fadeout);
To
startActivity(intent);
overridePendingTransition(new MyFadeInAnimation(), new MyFadeOutAnimation());
If not, is there a way for me to manually register an animation resource (and attain an ID) programatically?
I really do not want to define the activity transition animations as XML for other reasons.
Upvotes: 7
Views: 5469
Reputation: 25584
So one way to do this is to use Fragments. Set overridePendingTransition(0,0);
for the Activity
. and then in the Fragment
, override onCreateAnimator()
or if using the old animations, use android.support.v4.app.Fragment
and override onCreateAnimation()
.
Upvotes: 3