Transitions
Small details such as creating our own animations from the screen transitions will polish our app and really make it look more professional.
Our example is perfect to talk about transitions as we have two types of screen transitions:
- The first one is a transition between Activities, from
SplashActivity
toMainActivity
- The second one (not implemented yet) is a transition between fragments, where
ListFragment
is replaced withDetailsFragment
For the transitions between activities, we need to call overridePendingTransition
just before starting the new activity. The method receives two animations as parameters, and these animations can be in an XML file created by us or be chosen from the already created animations in Android. Run the following command:
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
In our example, we don't allow back navigation to SplashActivity
; however, if we were in a transition between activities where we wanted to have the same...