I wrote an application with multiple activities in it.
I would like to add a transition in between (Slide).
I wrote the following code:
@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().requestFeature( Window.FEATURE_ACTIVITY_TRANSITIONS );
getWindow().setEnterTransition( new Slide() );
super.onCreate( savedInstanceState );
setContentView( R.layout.activity_profile );
....
And then when I click a button to open another activity I use:
Intent intent = new Intent( DiscoverActivity.this, UploadActivity.class );
startActivity( intent, ActivityOptions.makeSceneTransitionAnimation( this ).toBundle() );
However, no matter if I changed to Explore() or Fade() or Slide() it seems like it keeps showing me Fade.
Am I doing something wrong?
Thank you
You need to set
setEnterTransitionin the Activity You are opening not in the currentActivitythat's what the name suggest its a transition which will apply during entering in theActivity.Move the below code to
UploadActivity. Also you can change theGravityofSlideby passing it Gravity by default itsGravity.BOTTOM.