Are Activity/Fragment Transitions compatible with pre-Lollipop devices? Are Activity/Fragment Transitions compatible with pre-Lollipop devices? android android

Are Activity/Fragment Transitions compatible with pre-Lollipop devices?


No, Activity/Fragment Transitions are not possible on pre-Lollipop devices. According to the documentation:

Start an activity with additional launch information, if able.

In Android 4.1+ additional options were introduced to allow for more control on activity launch animations. Applications can use this method along with ActivityOptionsCompat to use these animations when available. When run on versions of the platform where this feature does not exist the activity will be launched normally.

See also George Mount's answer to this StackOverflow question.


You can check out this library for activity and fragment transitions for pre lollipop devices

dependencies {        compile 'com.albinmathew:PreLollipopTransition:1.1.2'}

https://github.com/albinmathew/PreLollipopTransition


Although the fancy Lollipop Activity/Fragment transitions are not available pre-Lollipop (without the use of a 3rd party library), you can still override the animation used to transition between activities.

Just before/after you start invoke startActivity() you can make a call to [Activity.overridePendingTransition](http://developer.android.com/reference/android/app/Activity.html#overridePendingTransition(int, int)). When you leave your activity, call the same method.

Similarly you can use ActivityOptionsCompat to define a custom animation to use during a transition.

ActivityOptionsCompat opts =    ActivityOptionsCompat.makeCustomAnimation(getActivity(), R.anim.in, R.anim.out);startActivity(intent, opts.toBundle());