当前位置: 首页>>代码示例>>C#>>正文


C# View.Measure方法代码示例

本文整理汇总了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;
        }
开发者ID:hnhhzy,项目名称:BaiduMap_SDK_DEMO_for_Xamarin.Android,代码行数:15,代码来源:BMapUtil.cs

示例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);
    }
开发者ID:Toshik,项目名称:MonoDroid.PullToRefreshListView,代码行数:19,代码来源:PullToRefreshListView.cs

示例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;
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:15,代码来源:CellRenderer.cs

示例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;
            }
        }
开发者ID:GrimmRanger,项目名称:FGUtils,代码行数:28,代码来源:SwissListAdapter.cs


注:本文中的Android.Views.View.Measure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。