本文整理汇总了C#中Android.Views.View.SetLayerType方法的典型用法代码示例。如果您正苦于以下问题:C# View.SetLayerType方法的具体用法?C# View.SetLayerType怎么用?C# View.SetLayerType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Views.View
的用法示例。
在下文中一共展示了View.SetLayerType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTouch
public Boolean OnTouch(View v, MotionEvent ev)
{
if (_box != null)
{
v.SetLayerType(LayerType.Software, null);
switch (ev.Action)
{
case MotionEventActions.Down:
if (_touchState != TouchState.Result)
{
_touchState = TouchState.None;
}
int x = (int)ev.GetX();
int y = (int)ev.GetY();
Android.Graphics.Point cursor = new Android.Graphics.Point(x, y);
Android.Graphics.Point leftBot = new Android.Graphics.Point((int)(_box.MidX - _box.Width / 2), (int)(_box.MidY + _box.Height / 2));
Android.Graphics.Point rightBot = new Android.Graphics.Point((int)(_box.MidX + _box.Width / 2), (int)(_box.MidY + _box.Height / 2));
Android.Graphics.Point rightTop = new Android.Graphics.Point((int)(_box.MidX + _box.Width / 2), (int)(_box.MidY - _box.Height / 2));
double botLine = BitmapHelpers.LineToCursorDistance(cursor, leftBot, rightBot);
double rightLine = BitmapHelpers.LineToCursorDistance(cursor, rightTop, rightBot);
//Choose an binarized image and start OCR
if (_touchState == TouchState.Result)
{
if (x <= screenWidth / 2 && y <= screenHeight / 3)
{
threshhold = threshholds[0];
}
else if (x > screenWidth / 2 && y <= screenHeight / 3)
{
threshhold = threshholds[1];
}
else if (x <= screenWidth / 2 && y <= screenHeight * 2 / 3)
{
threshhold = threshholds[2];
}
else if (x > screenWidth / 2 && y <= screenHeight * 2 / 3)
{
threshhold = threshholds[3];
}
else if (x <= screenWidth / 2 && y <= screenHeight)
{
threshhold = threshholds[4];
}
else if (x > screenWidth / 2 && y <= screenHeight)
{
threshhold = threshholds[5];
}
_surfaceBox.SetOnTouchListener(null);
if (!_processDialog.IsShowing)
{
_processDialog.SetMessage("Waiting for character recognition...");
_processDialog.Show();
}
PerformResult();
}
//Move box over camera
else if (botLine <= lineDistance && rightLine <= lineDistance)
{
_touchState = TouchState.Mixed;
}
else if (botLine <= lineDistance)
{
_touchState = TouchState.Horizontal;
}
else if (rightLine <= lineDistance)
{
_touchState = TouchState.Vertical;
}
else if (x >= _box.MidX - _box.Width / 2 && x <= _box.MidX + _box.Width / 2 && y >= _box.MidY - _box.Height / 2 && y <= _box.MidY + _box.Height / 2)
{
_touchState = TouchState.Moving;
}
touchStartX = x;
touchStartY = y;
break;
case MotionEventActions.Move:
if (_touchState == TouchState.Moving)
{
_box.MidX += ev.GetX() - touchStartX;
_box.MidY += ev.GetY() - touchStartY;
}
else if (_touchState == TouchState.Horizontal)
{
_box.Height += ev.GetY() - touchStartY;
}
else if (_touchState == TouchState.Vertical)
{
_box.Width += ev.GetX() - touchStartX;
}
else if (_touchState == TouchState.Mixed)
{
_box.Width += ev.GetX() - touchStartX;
_box.Height += ev.GetY() - touchStartY;
}
touchStartX = ev.GetX();
touchStartY = ev.GetY();
break;
case MotionEventActions.Up:
if (_touchState == TouchState.Moving)
{
//.........这里部分代码省略.........
示例2: setLayerType
public static void setLayerType(View view, int layerType) {
view.SetLayerType((LayerType)layerType, null);
}
示例3: ManageLayer
private void ManageLayer(View v, bool enableHardware)
{
if (!IsHoneycomb)
{
return;
}
var layerType = enableHardware ? LayerType.Hardware : LayerType.None;
if (layerType != v.LayerType)
{
v.SetLayerType(layerType, null);
}
}