From 1ed01986ed496f87e1e5ecf54c4b2b96d65f894a Mon Sep 17 00:00:00 2001 From: daimajia Date: Sat, 30 Aug 2014 12:11:54 +0800 Subject: [PATCH] #10 --- library/src/main/java/com/daimajia/swipe/SwipeLayout.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/src/main/java/com/daimajia/swipe/SwipeLayout.java b/library/src/main/java/com/daimajia/swipe/SwipeLayout.java index 32b3cc3..9bc7871 100644 --- a/library/src/main/java/com/daimajia/swipe/SwipeLayout.java +++ b/library/src/main/java/com/daimajia/swipe/SwipeLayout.java @@ -682,6 +682,11 @@ public class SwipeLayout extends FrameLayout { * @return */ private View childNeed(ViewGroup v, MotionEvent event){ + if(v == null) return null; + + if(v.onTouchEvent(event)) + return v; + int childCount = v.getChildCount(); for(int i = childCount - 1; i >= 0; i--){ View child = v.getChildAt(i); @@ -704,6 +709,8 @@ public class SwipeLayout extends FrameLayout { * @return */ private boolean childNeed(View v, MotionEvent event){ + if(v == null) return false; + if(event.getX() > v.getLeft() && event.getX() < v.getRight() && event.getY() > v.getTop() && event.getY() < v.getBottom()){ return v.onTouchEvent(event);