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


C# View.Layout方法代码示例

本文整理汇总了C#中Android.Views.View.Layout方法的典型用法代码示例。如果您正苦于以下问题:C# View.Layout方法的具体用法?C# View.Layout怎么用?C# View.Layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Views.View的用法示例。


在下文中一共展示了View.Layout方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnTouch

 public bool OnTouch(View v, MotionEvent e)
 {
     switch (e.Action)
     {
     case MotionEventActions.Down:
         _viewX = e.GetX ();
         _viewY = e.GetY ();
         break;
     case MotionEventActions.Move:
         var left = (int)(e.RawX - _viewX);
         var right = (int)(left + v.Width);
         var top = (int)(e.RawY - _viewY);
         var bottom = (int)(v.Height + top);
         Console.WriteLine (left);
         Console.WriteLine (v.Width);
         if (left == v.Width-40) {
         //					TextView tv=new TextView(GetApplicationContext());
         //					tv.SetText("Avoided call with ex!");
         //					Resource.Layout.exDragGame   AddView(tv);
             Console.WriteLine ("hit the edge");
         }
         v.Layout (left, top, right, bottom);
         //				Console.WriteLine (" L " + left + " R " + right + " T " + top + " B " + bottom);
         break;
     }
     return true;
 }
开发者ID:kbyang,项目名称:PhoneApp,代码行数:27,代码来源:exDragGame.cs

示例2: 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

示例3: OnTouch

 public bool OnTouch(View v, MotionEvent e)
 {
     switch (e.Action)
     {
         case MotionEventActions.Down:
             _viewX = e.GetX();
             break;
         case MotionEventActions.Move:
             var left = (int)(e.RawX - _viewX);
             var right = (int)(left + v.Width);
             v.Layout(left, v.Top, right, v.Bottom);
             break;
     }
     return true;
 }
开发者ID:MTVaught,项目名称:VS-Xamarin-Examples,代码行数:15,代码来源:MainActivity.cs

示例4: OnLayout

        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            mContent = GetChildAt(1);
            if (mContent != null)
            {
                mContent.Layout(l, t, l + mContent.MeasuredWidth, t + mContent.MeasuredHeight);
            }

            int menuWidth = 0;
            View menu = GetChildAt(0);
            if (menu != null)
            {
                ViewGroup.LayoutParams layoutParams = menu.LayoutParameters;
                menuWidth = layoutParams.Width;
                menu.Layout(l - menuWidth, t, l, t + menu.MeasuredHeight);
            }
        }
开发者ID:Yi-shion,项目名称:Xamarin,代码行数:17,代码来源:MainActivity.cs


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