android - Which method gives the exact coordinates as those given by GestureDetector -


i want develop app. can detect if user touches specific view, action happen. implemented simpleongesturelistener detect , listen users' touches across screen. problem is, below posted methods, give different coordinates of same view , not know 1 should use compare coordinates given simpleongesturelistener.

methods give coordinates of views:

tv1.getlocalvisiblerect(tv1rect); tv1.getlocationonscreen(tv1loconscreen); tv1.settext("xcords: "+tv1.getx()+", ycords: "+tv1.gety()); 

to find out if view contains point touched can use

cgrectcontainspoint(your view frame, cgpoint of tap) 

you can cgpoint of tap gesture recognizer by

cgpoint location = [recognizer locationinview: view recognizer attached to]; 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -