From 934083393287f156bb4eeb5df817618bff89c03d Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Fri, 17 Jun 2016 19:55:06 +0100 Subject: =?UTF-8?q?[Android]=C2=A0Take=20in=20account=20status=20bar=20pad?= =?UTF-8?q?ding=20on=20master=20when=20using=20split=20behaviour=20in=20MD?= =?UTF-8?q?P=20(#226)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Xamarin.Forms.Platform.Android/AppCompat/MasterDetailPageRenderer.cs | 1 + Xamarin.Forms.Platform.Android/Renderers/MasterDetailContainer.cs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'Xamarin.Forms.Platform.Android') diff --git a/Xamarin.Forms.Platform.Android/AppCompat/MasterDetailPageRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/MasterDetailPageRenderer.cs index 18153218..50e99e50 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/MasterDetailPageRenderer.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/MasterDetailPageRenderer.cs @@ -122,6 +122,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat _masterLayout = new MasterDetailContainer(newElement, true, Context) { + TopPadding = ((IMasterDetailPageController)newElement).ShouldShowSplitMode ? statusBarHeight : 0, LayoutParameters = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent) { Gravity = (int)GravityFlags.Start } }; diff --git a/Xamarin.Forms.Platform.Android/Renderers/MasterDetailContainer.cs b/Xamarin.Forms.Platform.Android/Renderers/MasterDetailContainer.cs index 9184e269..7e28392f 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/MasterDetailContainer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/MasterDetailContainer.cs @@ -120,6 +120,7 @@ namespace Xamarin.Forms.Platform.Android double width = Context.FromPixels(right - left); double height = Context.FromPixels(bottom - top); double xPos = 0; + bool supressPadding = false; //splitview if (MasterDetailPageController.ShouldShowSplitMode) @@ -131,11 +132,13 @@ namespace Xamarin.Forms.Platform.Android } else { + //if we are showing the normal popover master doesn't have padding + supressPadding = isMasterPage; //popover make the master smaller width = isMasterPage && (Device.Info.CurrentOrientation.IsLandscape() || Device.Idiom == TargetIdiom.Tablet) ? DefaultWidthMaster : width; } - double padding = Context.FromPixels(TopPadding); + double padding = supressPadding ? 0 : Context.FromPixels(TopPadding); return new Rectangle(xPos, padding, width, height - padding); } -- cgit v1.2.3