Find View With Given X/y Coords In Android
is it possible to find the View that is displayed at a given absolute x/y pixel coord? Edit: I found a suitable Solution that works great: private View findViewByCoord(float x, flo
Solution 1:
One 'solution' would be to loop through the parent view's children and check the getLeft()
and getTop()
coordinates against the X and Y coordinates of your choice. If there is a match, you have your view.
I'd like to hear other alternatives though.
Edit: You'd also have to work out the height/width of the view too in relation to the left and top coordinates given to see if your coordinates are within that range.
Post a Comment for "Find View With Given X/y Coords In Android"