This article describes the method of Android to determine whether the touch event point is within the view range. Share it for your reference, as follows:
private Rect mChangeImageBackgroundRect = null; private boolean isInChangeImageZone(View view, int x, int y) { if (null == mChangeImageBackgroundRect) { mChangeImageBackgroundRect = new Rect(); } (mChangeImageBackgroundRect); int[] location = new int[2]; (location); = location[0]; = location[1]; = + location[0]; = + location[1]; return (x, y); }
where view is the view to be judged, x and y are Down X and Down Y
For more information about Android related content, please check out the topic of this site:Android debugging skills and solutions to common problems》、《Android development introduction and advanced tutorial》、《Android multimedia operation skills summary (audio, video, recording, etc.)》、《Summary of the usage of basic Android components》、《Android View View Tips Summary》、《Android layout layout tips summary"and"Android control usage summary》
I hope this article will be helpful to everyone's Android programming design.