本文整理汇总了C#中Android.Views.View.Measure方法的典型用法代码示例。如果您正苦于以下问题:C# View.Measure方法的具体用法?C# View.Measure怎么用?C# View.Measure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Views.View
的用法示例。
在下文中一共展示了View.Measure方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBitmapFromView
/**
* ´Óview µÃµ½Í¼Æ¬
* @param view
* @return
*/
public static Bitmap GetBitmapFromView(View view)
{
view.DestroyDrawingCache();
view.Measure(View.MeasureSpec.MakeMeasureSpec(0, MeasureSpecMode.Unspecified),
View.MeasureSpec.MakeMeasureSpec(0, MeasureSpecMode.Unspecified));
view.Layout(0, 0, view.MeasuredWidth, view.MeasuredHeight);
view.DrawingCacheEnabled = true;
Bitmap bitmap = view.GetDrawingCache(true);
return bitmap;
}
示例2: MeasureView
private void MeasureView(View child)
{
ViewGroup.LayoutParams p = child.LayoutParameters;
if (p == null)
p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent);
int childWidthSpec = ViewGroup.GetChildMeasureSpec(0, 0 + 0, p.Width);
int lpHeight = p.Height;
int childHeightSpec;
if (lpHeight > 0)
{
childHeightSpec = MeasureSpec.MakeMeasureSpec(lpHeight, MeasureSpecMode.Exactly);
}
else
{
childHeightSpec = MeasureSpec.MakeMeasureSpec(0, MeasureSpecMode.Unspecified);
}
child.Measure(childWidthSpec, childHeightSpec);
}
示例3: WireUpForceUpdateSizeRequested
protected void WireUpForceUpdateSizeRequested(Cell cell, AView nativeCell)
{
cell.ForceUpdateSizeRequested -= _onForceUpdateSizeRequested;
_onForceUpdateSizeRequested = delegate
{
// RenderHeight may not be changed, but that's okay, since we
// don't actually use the height argument in the OnMeasure override.
nativeCell.Measure(nativeCell.Width, (int)cell.RenderHeight);
nativeCell.SetMinimumHeight(nativeCell.MeasuredHeight);
nativeCell.SetMinimumWidth(nativeCell.MeasuredWidth);
};
cell.ForceUpdateSizeRequested += _onForceUpdateSizeRequested;
}
示例4: EnableExpandCollapse
private void EnableExpandCollapse(View parent, View expandingView, int position)
{
if (parent == _expandedView && position != _expandedViewPosition)
{
// _expandedView has been recycled,
_expandedView = null;
}
if (position == _expandedViewPosition)
{
// reset reference to _expandedView to maintain state and animation
_expandedView = parent;
}
expandingView.Measure(parent.Width, parent.Height);
LinearLayout.LayoutParams pms = (LinearLayout.LayoutParams)expandingView.LayoutParameters;
if (position == _expandedViewPosition)
{
expandingView.Visibility = ViewStates.Visible;
pms.BottomMargin = 0;
}
else
{
expandingView.Visibility = ViewStates.Gone;
pms.BottomMargin = -expandingView.MeasuredHeight;
}
}