Skip to content

Instantly share code, notes, and snippets.

@Char0394
Created March 24, 2021 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Char0394/63c612e822078c1ac87fcc7344dbf8b7 to your computer and use it in GitHub Desktop.
Save Char0394/63c612e822078c1ac87fcc7344dbf8b7 to your computer and use it in GitHub Desktop.
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using AView = Android.Views.View;
using Android.Content;
using SharedTransitionPrimSample.Views;
using SharedTransitionPrimSample.Droid;
using Plugin.SharedTransitions.Platforms.Android;
[assembly: ExportRenderer(typeof(CustomTransitionNavPage), typeof(CustomNavigationPageRenderer))]
namespace SharedTransitionPrimSample.Droid
{
public class CustomNavigationPageRenderer : SharedTransitionNavigationPageRenderer
{
public CustomNavigationPageRenderer(Context context) : base(context)
{
}
IPageController PageController => Element as IPageController;
CustomTransitionNavPage CustomNavigationPage => Element as CustomTransitionNavPage;
protected override void OnLayout(bool changed, int l, int t, int r, int b)
{
CustomNavigationPage.IgnoreLayoutChange = true;
base.OnLayout(changed, l, t, r, b);
CustomNavigationPage.IgnoreLayoutChange = false;
int containerHeight = b - t;
PageController.ContainerArea = new Rectangle(0, 0, Context.FromPixels(r - l), Context.FromPixels(containerHeight));
for (var i = 0; i < ChildCount; i++)
{
AView child = GetChildAt(i);
if (child is Android.Support.V7.Widget.Toolbar)
{
continue;
}
child.Layout(0, 0, r, b);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment