示例#1
0
  /** init mapview */
  public void initMap() {

    mMapView = (MapView) findViewById(R.id.bmapView);
    mBaiduMap = mMapView.getMap();

    // remove map logo
    mMapView.removeViewAt(1);

    int childCount = mMapView.getChildCount();
    View zoom = null;
    for (int i = 0; i < childCount; i++) {
      View child = mMapView.getChildAt(i);
      if (child instanceof ZoomControls) {
        zoom = child;
        break;
      }
    }
    zoom.setVisibility(View.GONE);

    mBaiduMap = mMapView.getMap();
    UiSettings mUiSettings = mBaiduMap.getUiSettings();
    mUiSettings.setCompassEnabled(false);

    mBaiduMap.setMyLocationEnabled(true);
    mLocClient = new LocationClient(this);
    mLocClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
    option.setOpenGps(true);
    option.setCoorType("bd09ll");
    option.setScanSpan(1000);
    option.setIsNeedAddress(true);
    mLocClient.setLocOption(option);
    mLocClient.start();
  }
示例#2
0
 /**
  * 是否启用指南针图层
  *
  * @param v
  */
 public void setCompassEnable(View v) {
   mUiSettings.setCompassEnabled(((CheckBox) v).isChecked());
 }
示例#3
0
 /**
  * 是否启用俯视手势
  *
  * @param v
  */
 public void setOverlookEnable(View v) {
   mUiSettings.setOverlookingGesturesEnabled(((CheckBox) v).isChecked());
 }
示例#4
0
 /**
  * 是否启用旋转手势
  *
  * @param v
  */
 public void setRotateEnable(View v) {
   mUiSettings.setRotateGesturesEnabled(((CheckBox) v).isChecked());
 }
示例#5
0
 /**
  * 是否启用平移手势
  *
  * @param v
  */
 public void setScrollEnable(View v) {
   mUiSettings.setScrollGesturesEnabled(((CheckBox) v).isChecked());
 }
示例#6
0
 /**
  * 是否启用缩放手势
  *
  * @param v
  */
 public void setZoomEnable(View v) {
   mUiSettings.setZoomGesturesEnabled(((CheckBox) v).isChecked());
 }