The example in this article describes how Android determines whether touch event points are in view scope. Share to everyone for your reference, specific as follows:
Private Rect mchangeimagebackgroundrect = null;
Private Boolean Isinchangeimagezone (view view, int x, int y) {
if (null = = Mchangeimagebackgroundrect) {
Mchangeim Agebackgroundrect = new Rect ();
}
View.getdrawingrect (mchangeimagebackgroundrect);
int[] location = new Int[2];
View.getlocationonscreen (location);
Mchangeimagebackgroundrect.left = location[0];
Mchangeimagebackgroundrect.top = location[1];
Mchangeimagebackgroundrect.right = Mchangeimagebackgroundrect.right + location[0];
Mchangeimagebackgroundrect.bottom = Mchangeimagebackgroundrect.bottom + location[1];
return Mchangeimagebackgroundrect.contains (x, y);
}
Where view is to judge the view, X,y is down X, down Y
For more information on Android-related content readers can view the site topics: "Android Debugging techniques and common problems solution summary", "Android Development introduction and Advanced Course", "Android Multimedia operating skills Summary (audio, video, recording, etc.)", " Android Basic Components Usage Summary, Android View tips Summary, Android layout layout tips and Android Control usage summary
I hope this article will help you with the Android program.