6
我想现在我用纬度和经度重点给标题重点标记如何通过标题标题关注Google标记?
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(26.89454, 75.82607), 15.0f));
所以有反正我可以专注于特定标记的标题名称标记的
我想现在我用纬度和经度重点给标题重点标记如何通过标题标题关注Google标记?
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(26.89454, 75.82607), 15.0f));
所以有反正我可以专注于特定标记的标题名称标记的
你可以使用标题作为密钥存储的标记在Map<String Marker>
:
private Map<String, Marker> markers = new HashMap<>();
当你添加标记到地图上,你还需要将它们添加到HashMap中:
String markerTitle = "My Marker";
LatLng markerPosition = new LatLng(26.89454, 75.82607);
Marker marker = mMap.addMarker(new MarkerOptions().position(markerPosition).title(markerTitle));
markers.put(markerTitle, marker); // Add the marker to the hashmap using it's title as the key
然后你就可以居中你的标记查询到散:
private void centerMarker(String title) {
Marker marker = markers.get(title);
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(marker.getPosition(), 15f));
}
和先生做ü有反正如果我取标记名称,从服务器中纬度和经度我又如何能做到这一点一样呢? –
你也可以这样做,你只需要从服务器获取数据并从那里设置位置和标题 – antonio
HashMap marker = result.get(i); –