public class MapContainer extends RelativeLayout { public MapContainer(Context context) { super(context); } public MapContainer(Context context, AttributeSet attrs) { super(context, attrs); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_UP) { requestDisallowInterceptTouchEvent(false); } else { requestDisallowInterceptTouchEvent(true);//告诉父View不要拦截我的事件 } return false; } @Override public boolean onTouchEvent(MotionEvent event) {//onTouchListener中返回false此方法才会被调用 return true; } }
xml中
<cn.com.zhwts.ui.MapContainer android:id="@+id/map_container" android:layout_width="match_parent" android:layout_height="wrap_content"> <com.amap.api.maps.TextureMapView android:id="@+id/mapWiew" android:layout_width="match_parent" android:layout_height="175dp" /> </cn.com.zhwts.ui.MapContainer> 参考http://blog.csdn.net/suqisq/article/details/52103657
本文介绍了如何处理在ScrollView中嵌入高德地图MapView时遇到的触摸事件冲突问题,提供了解决方案,确保用户可以正常滚动和使用地图功能。
2万+

被折叠的 条评论
为什么被折叠?



