谷歌地图Api V2 - 不显示标记标题

时间:2014-03-31 09:38:28

标签: android

触发onmarkerclick事件时,如何才能显示标记标题?我看到有几个人说要在事件中回归虚假,但我这样做并且它不起作用...... 这是我的代码:

@Override
    public boolean onMarkerClick(Marker marker) {
        if (serverPush) {
            serverPush = false;
            return false;
        }

        data.getMap().moveCamera(
                CameraUpdateFactory.newLatLngZoom(marker.getPosition(), data
                        .getMap().getCameraPosition().zoom));

        String id = marker.getTitle();
        if (id.equals(data.getUuid()) || id.equals(data.getOtherUUID())) {

        } else
            createDeleteDialog(marker, id,""+getResources().getString( R.string.delete_marker));

        // TODO Auto-generated method stub
        return false;
    }

2 个答案:

答案 0 :(得分:1)

@Override
public boolean onMarkerClick(final Marker marker) {

    marker.hideInfoWindow(); // hides the marker title

    return true; // must return true
}

答案 1 :(得分:0)

试试这段代码

 marker.position(latlong);
 marker.title(title);

 googleMap.addMarker(marker);
 builder.include(latlong);


 // Create Bound for camera using created builder
 LatLngBounds bounds = builder.build();
 // now move camera to specif bound
 googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds,
            width, height, 60));