[英]Turn off marker movement to the center of map Android
I am using a customize InfoWindow in Google Map using InfoWindowAdapter. 我正在使用InfoWindowAdapter在Google Map中使用自定义InfoWindow。 Every time I click on a marker, it moves to the center of the mobile screen and open the info window. 每次我单击一个标记时,它都会移动到移动屏幕的中央并打开信息窗口。 I was wondering if it is possible to stop the marker movement from the current location to the center. 我想知道是否可以停止标记从当前位置到中心的移动。 I am using the following code: 我正在使用以下代码:
googleMap.setInfoWindowAdapter(new UserInfoWindowAdapter(getLayoutInflater()));
googleMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(Marker marker) {
//other Code
}
});
Ok first the code: 好吧,首先代码:
mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
Marker mLastMarker;
@Override
public boolean onMarkerClick(Marker marker) {
if (marker.equals(mLastMarker)) {
// Same marker clicked twice - hide InfoWindow
mLastMarker = null;
marker.hideInfoWindow();
} else {
mLastMarker = marker;
marker.showInfoWindow();
}
return true;
}
});
Secondly the functionality that the above code provides: 其次,以上代码提供的功能:
return true;
) 覆盖默认的OnMarkerClick功能( return true;
) isInfoWindowShown
functionality as there is a known bug to that method 模仿isInfoWindowShown
功能,因为该方法存在一个已知的错误 Good luck! 祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.