protected override void OnLayout(bool changed, int l, int t, int r, int b) { AToolbar bar = _toolbar; // make sure bar stays on top of everything bar.BringToFront(); base.OnLayout(changed, l, t, r, b); int barHeight = ActionBarHeight(); if (barHeight != _lastActionBarHeight && _lastActionBarHeight > 0) { ResetToolbar(); bar = _toolbar; } _lastActionBarHeight = barHeight; bar.Measure(MeasureSpecFactory.MakeMeasureSpec(r - l, MeasureSpecMode.Exactly), MeasureSpecFactory.MakeMeasureSpec(barHeight, MeasureSpecMode.Exactly)); var barOffset = ToolbarVisible ? barHeight : 0; int containerHeight = b - t - ContainerPadding - barOffset; PageController.ContainerArea = new Rectangle(0, 0, Context.FromPixels(r - l), Context.FromPixels(containerHeight)); // Potential for optimization here, the exact conditions by which you don't need to do this are complex // and the cost of doing when it's not needed is moderate to low since the layout will short circuit pretty fast Element.ForceLayout(); bool toolbarLayoutCompleted = false; for (var i = 0; i < ChildCount; i++) { AView child = GetChildAt(i); Page childPage = (child as PageContainer)?.Child?.Element as Page; if (childPage == null) { return; } // We need to base the layout of both the child and the bar on the presence of the NavBar on the child Page itself. // If we layout the bar based on ToolbarVisible, we get a white bar flashing at the top of the screen. // If we layout the child based on ToolbarVisible, we get a white bar flashing at the bottom of the screen. bool childHasNavBar = NavigationPage.GetHasNavigationBar(childPage); if (childHasNavBar) { bar.Layout(0, 0, r - l, barHeight); child.Layout(0, barHeight + ContainerPadding, r, b); } else { bar.Layout(0, -1000, r, barHeight - 1000); child.Layout(0, ContainerPadding, r, b); } toolbarLayoutCompleted = true; } // Making the layout of the toolbar dependant on having a child Page could potentially mean that the toolbar is not laid out. // We'll do one more check to make sure it isn't missed. if (!toolbarLayoutCompleted) { if (ToolbarVisible) { bar.Layout(0, 0, r - l, barHeight); } else { bar.Layout(0, -1000, r, barHeight - 1000); } } }