我正在向我的SupportMapFragment
添加标记,如图所示。我希望自动显示标题,而不是要求用户点击标记。有办法吗?
googleMap.addMarker(new MarkerOptions()
.position(new LatLng(
Double.parseDouble(getArguments().getString("lat")),
Double.parseDouble(getArguments().getString("lng"))
))
.title(getArguments().getString("name")));
try {
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(
new LatLng(
Double.parseDouble(getArguments().getString("lat")),
Double.parseDouble(getArguments().getString("lng")))
, new Float(15.0)
));
} catch (Exception e) {
//ignore
}
答案 0 :(得分:3)
感谢@JigneshJain,
Marker marker = googleMap.addMarker(new MarkerOptions()
.position(new LatLng(
Double.parseDouble(getArguments().getString("lat")),
Double.parseDouble(getArguments().getString("lng"))
))
.title(getArguments().getString("name")));
marker.showInfoWindow();