高德地图根据覆盖物范围显示地图


List latLngs = new ArrayList();

latLngs.add(new LatLng(36.5333737316, 117.5162532850));
latLngs.add(new LatLng(36.5333737316, 117.5162532850));
latLngs.add(new LatLng(36.0015213728, 117.2966122508));
latLngs.add(new LatLng(36.0015213728, 117.2966122508));
aMap.addPolyline(new PolylineOptions()
        .addAll(latLngs)
        .width(55)
        .zIndex(1)
        .setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.bg_route_gray))
        .color(Color.argb(255, 1, 1, 1)));
//上面这一步已完成画线
aMap.addMarker(new MarkerOptions()
        .position(new LatLng(36.5333737316, 117.5162532850))
        .icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_address_start_blue)));

aMap.addMarker(new MarkerOptions()
        .position(new LatLng(36.0015213728, 117.2966122508))
        .icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_address_end_orange)));
//上面这一步则加上起始点的icon
LatLng northeast = new LatLng(36.0015213728, 117.5162532850);//经纬度最大值
LatLng southwest = new LatLng(36.5333737316, 117.2966122508);//经纬度最小值
LatLngBounds bounds = new LatLngBounds.Builder().include(northeast)
        .include(southwest).build();
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, 100);
this.aMap.animateCamera(cameraUpdate, 100L, (AMap.CancelableCallback) null);

//这一步则是根据把画的线显示在地图的正中央

你可能感兴趣的:(Android)