summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/LayoutExtensions.cs
blob: 90427b6199577dad1f9a48c33fd829989bf30bdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using System.Collections.Generic;
using AView = Android.Views.View;

namespace Xamarin.Forms.Platform.Android
{
	public static class LayoutExtensions
	{
		public static void Add(this IList<View> children, AView view, GetDesiredSizeDelegate getDesiredSizeDelegate = null, OnLayoutDelegate onLayoutDelegate = null,
							   OnMeasureDelegate onMeasureDelegate = null)
		{
			children.Add(view.ToView(getDesiredSizeDelegate, onLayoutDelegate, onMeasureDelegate));
		}

		public static View ToView(this AView view, GetDesiredSizeDelegate getDesiredSizeDelegate = null, OnLayoutDelegate onLayoutDelegate = null, OnMeasureDelegate onMeasureDelegate = null)
		{
			return new NativeViewWrapper(view, getDesiredSizeDelegate, onLayoutDelegate, onMeasureDelegate);
		}
	}
}