Xamarin Android - Create a line where the finger passes

2

Hello, I would like to create a straight or rectangle, where my finger goes. It does not really have to be exactly where to go, but on top of each button I move the finger it increases the rectangle, as if it were a selection of a word in a "wordplay." I have a GridLayout of 15x15 and a button inside each cell.

Home I tried to put the onTouch of each button as below but it did not.

    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;
    }
    
asked by anonymous 28.12.2016 / 17:50

0 answers