Forum Xamarin.Forms

[Android] Keep popped page visible while it transitions off the screen.

mlon174mlon174 Member
edited February 2018 in Xamarin.Forms

I'm trying to add native feeling animations to my app to add a professional finish.

I've overridden the navigation page renderer to implement my own animations on transitions with the following code...

[assembly: ExportRenderer(typeof(NavigationPage), typeof(NavigationPageCustomRenderer))]
namespace App1.Droid
{
public class NavigationPageCustomRenderer : Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer
{
public NavigationPageCustomRenderer(Context context) : base(context)
{

    }

    protected override void SetupPageTransition(FragmentTransaction transaction, bool isPush)
    {
        if (isPush)
            transaction.SetCustomAnimations(Resource.Animation.enter_from_right, Resource.Animation.exit_to_left);
        else
        {
            transaction.SetCustomAnimations(Resource.Animation.enter_from_left, Resource.Animation.exit_to_right);
        }
    }
}

}

My issue is that when I pop a page using Navigation.PopAsync(), the popped page is hidden before it has a chance to animate. This means the entering page is flying into an empty view rather than emerging from behind the current page.

Has anyone got a workaround for this?

Sign In or Register to comment.