简体   繁体   English

如何从标记列表中将特定标记置于中心

[英]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.

相关问题 如何从标记列表中提取标记信息 - How to extract a marker info from a list of markers 如何单击地图上多个标记中的一个标记,然后转到包含标记信息的活动 - How to click a marker from multiple markers on a map and then go to a activity with info of the markers 如何从Android中谷歌地图中心的固定标记获取坐标 - How to get coordinate from fixed marker at center of google maps in android 如何在Android中启用缩放功能的情况下将标记放置在地图底部而不是地图中心(默认情况下)? - How to put marker at bottom of map instead of center(by default) of map with zoom enabled in android? 如何从Android中的Google地图中删除特定标记 - How to remove a particular marker from Google Map in Android 如何在GoogleMaps中更新标记并识别标记位置 - How to Update Marker And Indentify Markers Positions In GoogleMaps 如何在地图中心设置标记? - How to set marker on center of the map? 如何在地图上放置来自firebase的人的图像标记? - How to put a marker of the image of a person from firebase on the map? 如何接收从Firebase存储的纬度和经度数据并将其放入标记中 - How to receive latitude and longitude data stored from Firebase and put it in a marker 每当用户更改Google Map Android中的位置时,如何检查用户是否处于标记之一(从10000个标记中)? - How to check if user in one of marker (from 10000 of markers) everytime user change location in google map android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM