3
Hello, I would like to create a straight or rectangular, where my finger goes.
Actually, it doesn’t have to be exactly where you go,
but on top of every button I pass the finger it will increase the rectangle,
as if it were a selection of a word in a "word search".
I have a GridLayout
15x15 and a button
within each cell.
I tried to put on onTouch of each button as below but did not give.
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);
break;
case MotionEventActions.Up:
Canvas c = new Canvas();
c.DrawRect(new Rect((int)_viewX, (int)_viewY, (int)_viewX + 200, (int)_viewY + 200), new Paint() { Color = Color.Red });
((GirdLayout)v.Parent).Draw(c);
break;
}
return true;
}