4

I need to place google map view inside SwipeRefreshLayout, the problem is that SwipeRefreshLayout overwrites google maps on touch event. When i try to scroll map upwards SwipeRefreshLayout event is getting triggered. How could i disable SwipeRefreshLayout events when i scroll google maps?

1
  • put up your current code Commented Oct 4, 2016 at 6:40

1 Answer 1

0

I found solution to this problem in this thread proposed by Shiba J. I extended SwipeRefreshLayout and overrode onInterceptTouchEvent.

public class OverviewSwipeRefreshLayout extends SwipeRefreshLayout { public OverviewSwipeRefreshLayout(Context context) { super(context); } public OverviewSwipeRefreshLayout(Context context, AttributeSet attrs) { super(context, attrs); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { final int action = ev.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: super.onTouchEvent(ev); break; case MotionEvent.ACTION_MOVE: return false; case MotionEvent.ACTION_CANCEL: super.onTouchEvent(ev); break; case MotionEvent.ACTION_UP: return false; default: break; } return false; } @Override public boolean onTouchEvent(MotionEvent ev) { super.onTouchEvent(ev); return true; } } 
Sign up to request clarification or add additional context in comments.

1 Comment

unfortunately this is not working for me. It is layout specific

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.