public static boolean inTouchInslideOfView(View view, MotionEvent ev) {
int[] location = new int[2];
view.getLocationInWindow(location);
int x = location[0];
int y = location[1];
if (ev.getX() > x && ev.getX() < (x + view.getWidth()) && ev.getY() > y && ev.getY() < (y + view.getHeight())){
return true;
}
return false;
}
本文提供了一个Java方法,用于判断触摸事件是否在指定视图内部触发,通过获取视图的位置并比较触摸事件坐标来实现。

637

被折叠的 条评论
为什么被折叠?



