N
N
Nikolarsen2018-03-14 20:35:59
Java
Nikolarsen, 2018-03-14 20:35:59

How to add textview with one touch?

Please tell me...
You need to open the alertdialog with edittext with one touch to the screen. After send the text from the edittext to the TextView at the touch location.

private void onDrawTexts(Canvas canvas) {
        float dx = Math.abs(mx - mStartX);
        float dy = Math.abs(my - mStartY);
        if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
            
        }
    }
private void onTouchEventTexts(MotionEvent event) {
 
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                isDrawing = true;
                mStartX = mx;
                mStartY = my;   
                invalidate();
                break;
            case MotionEvent.ACTION_MOVE:
                invalidate();
                break;
            case MotionEvent.ACTION_UP:
                isDrawing = false;
                String txt = "0000" ;
                mCanvas.drawText (txt, mx,my,mPaintText);
                invalidate();
                break;
        }
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question