/// <summary> /// Utility to return a default size.<br /> /// Uses the supplied size if the MeasureSpec imposed no constraints. Will get larger if allowed by the /// MeasureSpec.<br /> /// </summary> /// <param name="size"> Default size for this layout.</param> /// <param name="measureSpec"> Constraints imposed by the parent.</param> /// <returns>The size this layout should be.</returns> public static LayoutLength GetDefaultSize(LayoutLength size, LayoutMeasureSpec measureSpec) { return(LayoutItemWrapperImpl.GetDefaultSize(size, measureSpec)); }
/// <summary> /// Measure the layout and its content to determine the measured width and the measured height.<br /> /// If this method is overridden, it is the subclass's responsibility to make /// sure the measured height and width are at least the layout's minimum height /// and width. <br /> /// </summary> /// <param name="widthMeasureSpec">horizontal space requirements as imposed by the parent.</param> /// <param name="heightMeasureSpec">vertical space requirements as imposed by the parent.</param> protected virtual void OnMeasure(LayoutMeasureSpec widthMeasureSpec, LayoutMeasureSpec heightMeasureSpec) { SetMeasuredDimensions(new MeasuredSize(LayoutItemWrapperImpl.GetDefaultSize(layoutItemWrapperImpl.GetSuggestedMinimumWidth(), widthMeasureSpec)), new MeasuredSize(LayoutItemWrapperImpl.GetDefaultSize(layoutItemWrapperImpl.GetSuggestedMinimumHeight(), heightMeasureSpec))); }