diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/ShellFlyoutBackground.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/ShellFlyoutBackground.cs index 85bb5c8147e..ad4956002ae 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/ShellFlyoutBackground.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/ShellFlyoutBackground.cs @@ -26,11 +26,14 @@ public ShellFlyoutBackground() protected override void Init() { - AddFlyoutItem(CreateContentPage(), "Item 1"); - AddFlyoutItem(CreateContentPage(), "Item 2"); + for (int i = 0; i < 20; i++) + { + AddFlyoutItem(CreateContentPage(), $"Item {i}"); + } FlyoutBackgroundImage = "photo.jpg"; FlyoutBackgroundImageAspect = Aspect.AspectFill; + FlyoutVerticalScrollMode = ScrollMode.Enabled; } ContentPage CreateContentPage() @@ -148,6 +151,52 @@ ContentPage CreateContentPage() } }), AutomationId = "ToggleHeaderFooter" + }, + new Button() + { + Text = "Toggle Header/Footer Transparent", + Command = new Command(() => + { + if (FlyoutHeader == null) + { + FlyoutFooter = + new Label() + { + Text = "The FOOTER", + TextColor = Color.Blue, + HeightRequest = 50 + }; + + FlyoutHeader = + new StackLayout + { + Orientation = StackOrientation.Horizontal, + HeightRequest = 100, + Children = { + new Label() + { + Text = "The HEADER", + FontSize = 25, + FontAttributes = FontAttributes.Bold, + VerticalTextAlignment = TextAlignment.Center, + TextColor = Color.Blue, + }, + new Button() + { + Text = "OK", + FontSize = 25, + TextColor = Color.Green, + Command = new Command(() => DisplayAlert("Button", "ThisButtonWorks", "OK")) + } + } + }; + } + else + { + FlyoutHeader = FlyoutFooter = null; + } + }), + AutomationId = "ToggleHeaderFooterTransparent" } } }; diff --git a/Xamarin.Forms.Platform.Android/Renderers/ContainerView.cs b/Xamarin.Forms.Platform.Android/Renderers/ContainerView.cs index 9fc382c417f..2e3fd55d336 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ContainerView.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ContainerView.cs @@ -62,13 +62,12 @@ protected override void OnLayout(bool changed, int l, int t, int r, int b) var width = Context.FromPixels(r - l); var height = Context.FromPixels(b - t); - - _shellViewRenderer.LayoutView(width, height); + LayoutView(0, 0, width, height); } protected virtual void LayoutView(double x, double y, double width, double height) { - View?.Layout(new Rectangle(x, y, width, height)); + _shellViewRenderer.LayoutView(width, height); } protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec) diff --git a/Xamarin.Forms.Platform.Android/Renderers/ShellFlyoutTemplatedContentRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ShellFlyoutTemplatedContentRenderer.cs index be7d502ffc2..768de82ddc6 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ShellFlyoutTemplatedContentRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ShellFlyoutTemplatedContentRenderer.cs @@ -549,19 +549,8 @@ void UpdateElevation() protected override void LayoutView(double x, double y, double width, double height) { - var context = Context; - var paddingLeft = context.FromPixels(PaddingLeft); - var paddingTop = context.FromPixels(PaddingTop); - var paddingRight = context.FromPixels(PaddingRight); - var paddingBottom = context.FromPixels(PaddingBottom); - - width -= paddingLeft + paddingRight; - height -= paddingTop + paddingBottom; - UpdateElevation(); - - if (View != null) - View.Layout(new Rectangle(paddingLeft, paddingTop, width, height)); + base.LayoutView(x, y, width, height); } protected override void Dispose(bool disposing) diff --git a/Xamarin.Forms.Platform.Android/Resources/Layout/FlyoutContent.axml b/Xamarin.Forms.Platform.Android/Resources/Layout/FlyoutContent.axml index 551b6c8b2f9..184373299c0 100644 --- a/Xamarin.Forms.Platform.Android/Resources/Layout/FlyoutContent.axml +++ b/Xamarin.Forms.Platform.Android/Resources/Layout/FlyoutContent.axml @@ -12,6 +12,8 @@ android:id="@+id/flyoutcontent_appbar" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="@null" + app:elevation="0dp" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />