public View findChildViewUnder ( float x , float y ) { final int count = getChildCount ( ) ; for ( int i = count - 1 ; i >= 0 ; i -- ) { final View child = getChildAt ( i ) ; final float translationX = ViewCompat . getTranslationX ( child ) ; final float translationY = ViewCompat . getTranslationY ( child ) ; if ( x >= child . getLeft ( ) + translationX && x <= child . getRight ( ) + translationX && y >= child . getTop ( ) + translationY && y <= child . getBottom ( ) + translationY ) { return child ; } } return null ; }
Find the topmost view under the given point .