本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
}