void SetChildLayout(FloatingView child) { var renderer = PlatformUtility.GetOrCreateNativeView(child, Context); var nativeChild = renderer.View; Element.LayoutChild(child); int width = -1; int height = -1; if (child.HorizontalLayoutAlignment != XF.LayoutAlignment.Fill) { width = (int)Context.ToPixels(child.Bounds.Width); } if (child.VerticalLayoutAlignment != XF.LayoutAlignment.Fill) { height = (int)Context.ToPixels(child.Bounds.Height); } using (var param = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent) { Width = width, Height = height, Gravity = GetGravity(child), }) { SetOffsetMargin(param, child); Control.AddView(nativeChild, param); } }
protected override void Dispose(bool disposing) { if (disposing) { Element.Parent = null; _page.SizeChanged -= PageSizeChanged; foreach (var child in Element) { PlatformUtility.DisposeModelAndChildrenRenderers(child); } RootView.RemoveFromParent(); _page = null; } base.Dispose(disposing); }