将所有的overlay显示在视野内

verlayManager = new OverlayManager(mBaiduMap) {

            @Override
            public boolean onPolylineClick(Polyline polyline) {
                return false;
            }

            @Override
            public boolean onMarkerClick(Marker marker) {

                //因为这里复写了onMarkerClick方法所以 mBaiduMap.setOnMarkerClickListener()无效了
                //要在 mBaiduMap.setOnMarkerClickListener()往这里传marker;把需要实现的方法写在这里
                if (marker != mainMarker) {
                    BitmapDescriptor bdA = BitmapDescriptorFactory.fromResource(R.drawable.car_location_normal);
                    mainMarker.setIcon(bdA);
                    bdA = BitmapDescriptorFactory.fromResource(R.drawable.car_locaiton_selected);
                    marker.setIcon(bdA);
                    mainMarker = marker;
                    showInfo(objectAllIDDatas.get(Integer.parseInt(marker.getTitle())));
                    if(!drawer.mExpanded)
                    drawer.animateOpen();
                }
                return true;
            }

            @Override
            public List getOverlayOptions() {

                return myOverlayOptions;//显示的覆盖物

            }
        };


        overlayManager.addToMap();
        overlayManager.zoomToSpan();

你可能感兴趣的:(将所有的overlay显示在视野内)