private boolean isViewHit ( View view , int x , int y ) { int [ ] viewLocation = new int [ 2 ] ; view . getLocationOnScreen ( viewLocation ) ; int [ ] parentLocation = new int [ 2 ] ; this . getLocationOnScreen ( parentLocation ) ; int screenX = parentLocation [ 0 ] + x ; int screenY = parentLocation [ 1 ] + y ; return screenX >= viewLocation [ 0 ] && screenX < viewLocation [ 0 ] + view . getWidth ( ) && screenY >= viewLocation [ 1 ] && screenY < viewLocation [ 1 ] + view . getHeight ( ) ; }
Calculate if one position is above any view .