Search code examples
androidanimationandroid-5.0-lollipoptransition

How can I disable lollipop out transition animation in Android


I want added lollipop transitions to my app and it's really great. It's share my view from one activity to another with smooth animation, but I want to disable this animation when I exit from second screen to first screen and I can not find how to do id. My theme has this styles:

        <item name="android:windowActivityTransitions">true</item>
    <item name="android:windowContentTransitions">true</item>
    <item name="android:windowAllowEnterTransitionOverlap">true</item>
    <item name="android:windowAllowReturnTransitionOverlap">false</item>
    <item name="android:fragmentAllowEnterTransitionOverlap">@bool/default_underline_indicator_fades</item>
    <item name="android:fragmentAllowReturnTransitionOverlap">@bool/default_underline_indicator_fades</item>

Solution

  • Okay, I find out how to turn of the exit transition. I delete transition name from the view after some delay:

     view.postDelayed(new Runnable() {
                @Override
                public void run() {
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                        view.setTransitionName("some unused transition name");
                    }
                }
            }, 500);
    

    And if it's deletes - it won't be shared when activity finish