void InitView() { NotchLayout = new LinearLayout(Container.Context); NotchLayout.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent); var button = new Android.Widget.Button(Container.Context); button.Text = "Notch"; var page = Element as Page; if (NotchInfo.Model == PhoneModels.Custom) { Device = NotchInfo.CustomDevice; } else { Device = Devices[NotchInfo.Model]; } var notch = new NotchView(Container.Context) { Device = Device }; NotchLayout.AddView(notch); Container.AddView(NotchLayout); NotchLayout.Parent.BringChildToFront(NotchLayout); Container.LayoutChange += (sender, e) => { if (NotchLayout != null) { var msw = MeasureSpec.MakeMeasureSpec(e.Right, MeasureSpecMode.Exactly); var msh = MeasureSpec.MakeMeasureSpec(e.Bottom, MeasureSpecMode.Exactly); NotchLayout.Measure(msw, msh); NotchLayout.Layout(0, 0, e.Right, e.Bottom); NotchLayout.Parent.BringChildToFront(NotchLayout); } }; }
void InitView() { NotchLayout = new LinearLayout(Context); NotchLayout.LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent); var button = new Android.Widget.Button(Context); button.Text = "Notch"; var notchedPage = Element as NotchedPage; if (notchedPage.Model == PhoneModels.Custom) { device = notchedPage.CustomDevice; } else { device = Devices[notchedPage.Model]; } Element.Padding = new Thickness(Element.Padding.Left, Element.Padding.Top + device.StatusBarHeight, Element.Padding.Right, Element.Padding.Bottom); var notch = new NotchView(Context) { Device = device }; NotchLayout.AddView(notch); AddView(NotchLayout); NotchLayout.Parent.BringChildToFront(NotchLayout); //NotchLayout.SetBackgroundColor(Color.ForestGreen); }