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 Answer
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; } } 1 Comment
Kamen Dobrev
unfortunately this is not working for me. It is layout specific