Answer the question
In order to leave comments, you need to log in
How to handle click on drawText?
I draw an arrow with text in the center. How can I make it so that when I click on the text, I can change it.
private void onTouchEventStrelka(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;
mCanvas.drawLine(mStartX, mStartY, mx, my, mPaintFinal) ;
fillArrow(mPaintFinal,mCanvas,mStartX,mStartY,mx,my);
fillArrow(mPaintFinal,mCanvas,mx,my,mStartX,mStartY);
mCenter= mx/2+mStartX/2 ;
mCenter2=my/2+ mStartY/2;
String txt = "0000" ;
mCanvas.drawText (txt, mCenter,mCenter2,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 questionAsk a Question
731 491 924 answers to any question