Skip to content Skip to sidebar Skip to footer

Draw Circle Where User Touches Screen

I draw a circle where the user touches a image view. It draws the circle fine, but it is not where the user touches. It is always off the left by a lot. Here is the code: getting t

Solution 1:

Try to draw at

touchX=touchX- image.getWidth() / 2;touchY=touchY- image.getHeight() / 2;

this will draw the center of the image the place you touch

Solution 2:

You have to add touch listener to the layout not to the image. Add setOnTouchListener to the layout. No need of touch listener to the image.

Solution 3:

Have a look at Hello circle example

Post a Comment for "Draw Circle Where User Touches Screen"