Bug 50787 - Can't animate Fragment transition when it's being removed from the stack
Summary: Can't animate Fragment transition when it's being removed from the stack
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: E.Z. Hart [MSFT]
Depends on:
Reported: 2016-12-25 05:12 UTC by adrianknight89
Modified: 2018-01-11 12:12 UTC (History)
7 users (show)

Tags: android, fr
Is this bug a regression?: ---
Last known good build:

repro (63.01 KB, application/zip)
2016-12-25 05:12 UTC, adrianknight89

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 50787 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description adrianknight89 2016-12-25 05:12:50 UTC
Created attachment 18988 [details]

Please see repro.

I wanted to use setCustomAnimations https://developer.android.com/reference/android/app/FragmentTransaction.html#setCustomAnimations(int, int) to animate page enter and exit on AppCompat. However, when the page is being popped, all I see is a white background instead of the page exiting to the right.

Expected behavior:

Push: Enter from right (topmost page exits to left)
Pop: Enter from left (topmost page exits to right)

Actual behavior:

Everything works except for the 4th transition.


Currently, SetupPageTransition in my sample is using:

transaction.SetCustomAnimations(Resource.Animation.enter_from_right, Resource.Animation.exit_to_left);
transaction.SetCustomAnimations(Resource.Animation.enter_from_left, Resource.Animation.exit_to_right);

but I also expect the following to work:
transaction.SetCustomAnimations(Resource.Animation.enter_from_right, Resource.Animation.exit_to_left,Resource.Animation.enter_from_left, Resource.Animation.exit_to_right)
Comment 1 adrianknight89 2016-12-26 03:12:27 UTC
This seems to be due to the fact that we're removing fragments instead of hiding them. When they are removed, animations are not supported. However, hiding them won't call OnDestroyView. I'm sure there is a proper way to do this, but I don't know it.
Comment 3 adrianknight89 2016-12-26 06:21:20 UTC
Comment 4 Paul Brenner 2017-12-18 19:11:38 UTC
Should this be set back to confirmed? The PR was closed back in July with a note saying the fix will be handled differently, just wondering if this is actually being worked on.
Comment 5 Paul Vrugt 2018-01-11 12:12:53 UTC
I'm running into the same issue