void IPlatformLayout.OnLayout(bool changed, int l, int t, int r, int b) { if (changed) { LayoutRootPage(Page, r - l, b - t); } Android.Platform.GetRenderer(Page).UpdateLayout(); for (var i = 0; i < _renderer.ChildCount; i++) { global::Android.Views.View child = _renderer.GetChildAt(i); if (child is ModalContainer) { child.Measure(MeasureSpecFactory.MakeMeasureSpec(r - l, MeasureSpecMode.Exactly), MeasureSpecFactory.MakeMeasureSpec(t - b, MeasureSpecMode.Exactly)); child.Layout(l, t, r, b); } } }
static SizeRequest?SizeBrokenControl(NativeViewWrapperRenderer renderer, int widthConstraint, int heightConstraint) { global::Android.Views.View nativeView = renderer.Control; if ((widthConstraint == 0 && heightConstraint == 0) || nativeView == null) { return(null); } int width = global::Android.Views.View.MeasureSpec.GetSize(widthConstraint); int widthSpec = global::Android.Views.View.MeasureSpec.MakeMeasureSpec(width * 2, global::Android.Views.View.MeasureSpec.GetMode(widthConstraint)); nativeView.Measure(widthSpec, heightConstraint); var size = new Size(nativeView.MeasuredWidth, nativeView.MeasuredHeight); return(new SizeRequest(size)); }