[英]how to put particular marker in center from list of markers
i have ListView which showing the number of locations, when i click on any location the map is showing with marker of all the list of location but i want to show the selected location's marker in center and others are there area. 我有ListView显示位置的数量,当我单击任何位置时,地图将显示所有位置列表的标记,但是我想在中心显示所选位置的标记,而其他区域则存在。
How to show the selected location in center and others are as it is 如何在中心显示所选位置,其他位置照原样显示
gMap is the object of GoogleMap
gMap是GoogleMap
的对象
gMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(com.google.android.gms.maps.model.Marker marker) {
marker.showInfoWindow();
LatLng currentPoint = new LatLng(26.5886, 72.982);// pass here your selected marker coordinate(Latitude & Longitude) like lat
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(currentPoint, 7);// set here your zoom level
gMap.animateCamera(cameraUpdate);
return true;
}
});
for eg 例如
gMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(com.google.android.gms.maps.model.Marker marker) {
marker.showInfoWindow();
YourModel myMarker = mMarkersHashMap.get(marker);// it is your model
LatLng currentPoint = new LatLng(Double.valueOf(myMarker.getLat()), Double.valueOf(myMarker.getLon()));
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(currentPoint, 7);
gMap.animateCamera(cameraUpdate);
return true;
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.