无法居中标记的信息窗口?

时间:2016-08-01 11:55:11

标签: android google-maps

我正在尝试将标记的信息窗口居中,因为它完全可见。有两个图像显示问题。在第一个信息窗口的标题是不可见的,在第二个图像上是它应该是什么样子。这是我的代码:

mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
        @Override
        public boolean onMarkerClick(final Marker marker) {

            LatLng markerLocation = marker.getPosition();
            Point mappoint = mMap.getProjection().toScreenLocation(new LatLng(markerLocation.latitude, markerLocation.longitude));
            mappoint.set(mappoint.x, mappoint.y - 100);

            CameraUpdate cu = CameraUpdateFactory.newLatLng(mMap.getProjection().fromScreenLocation(mappoint));

            mMap.animateCamera(cu, new GoogleMap.CancelableCallback() {
                @Override
                public void onFinish() {
                    if (marker != null)
                        marker.showInfoWindow();
                }
                @Override
                public void onCancel() {
                }
            });

            return false;
        }
    });

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

问题在于:

returning false;

应该是:

returning true;