Created
August 28, 2016 10:41
-
-
Save vincent1086/132d6411eda947eebc606fdd692e4e9f to your computer and use it in GitHub Desktop.
Android - MapView inside ScrollView fix bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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