Skip to content Skip to sidebar Skip to footer

Android Touchevent--- Need Help/suggestion According To Scenario

Now I have an ImageView and its a circle which is at the slightly below than center position (But this should not matter). I have written code onTouch of ImageView for ACTION_DOW

Solution 1:

Within your onTouch method record a boolean to check if the user is touching within the bounds of the circle.

boolean inCircle = java.lang.Math.sqrt(x*x + y*y) <= circleRadius

Where x is taken from event.getX() - circleCenterX and y is taken from event.getY() - circleCenterY (touch position's offset from center of the circle)

Post a Comment for "Android Touchevent--- Need Help/suggestion According To Scenario"