Skip to content

Instantly share code, notes, and snippets.

@vincent1086
Created August 28, 2016 10:41
Show Gist options
  • Save vincent1086/132d6411eda947eebc606fdd692e4e9f to your computer and use it in GitHub Desktop.
Save vincent1086/132d6411eda947eebc606fdd692e4e9f to your computer and use it in GitHub Desktop.
Android - MapView inside ScrollView fix bug
public class ScrollMapView extends MapView {
private final static String TAG = "ScrollMapView";
public ScrollMapView(Context context) {
super(context);
}
public ScrollMapView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_UP:
LogUtil.i(TAG, "unlocked");
this.getParent().requestDisallowInterceptTouchEvent(false);
break;
case MotionEvent.ACTION_DOWN:
LogUtil.i(TAG, "locked");
this.getParent().requestDisallowInterceptTouchEvent(true);
break;
}
return super.dispatchTouchEvent(ev);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment