当前位置: 首页>>代码示例>>Java>>正文


Java MapboxMapOptions类代码示例

本文整理汇总了Java中com.mapbox.mapboxsdk.maps.MapboxMapOptions的典型用法代码示例。如果您正苦于以下问题:Java MapboxMapOptions类的具体用法?Java MapboxMapOptions怎么用?Java MapboxMapOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MapboxMapOptions类属于com.mapbox.mapboxsdk.maps包,在下文中一共展示了MapboxMapOptions类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import com.mapbox.mapboxsdk.maps.MapboxMapOptions; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  // Mapbox access token is configured here. This needs to be called either in your application
  // object or in the same activity which contains the mapview.
  Mapbox.getInstance(this, getString(R.string.access_token));

  // Configure initial map state
  MapboxMapOptions options = new MapboxMapOptions()
    .attributionTintColor(RED_COLOR)
    .compassFadesWhenFacingNorth(false)
    .styleUrl(Style.MAPBOX_STREETS)
    .camera(new CameraPosition.Builder()
      .target(new LatLng(25.255377, 55.3089185))
      .zoom(11.86)
      .tilt(10)
      .build());

  mapView = new MapView(this, options);
  mapView.setId(R.id.mapView);
  mapView.onCreate(savedInstanceState);
  mapView.getMapAsync(this);
  setContentView(mapView);
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:26,代码来源:PolygonHolesActivity.java

示例2: onCreate

import com.mapbox.mapboxsdk.maps.MapboxMapOptions; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  // Mapbox access token is configured here. This needs to be called either in your application
  // object or in the same activity which contains the mapview.
  Mapbox.getInstance(this, getString(R.string.access_token));

  MapboxMapOptions options = new MapboxMapOptions()
    .styleUrl(Style.OUTDOORS)
    .camera(new CameraPosition.Builder()
      .target(new LatLng(43.7383, 7.4094))
      .zoom(12)
      .build());

  // create map
  mapView = new MapView(this, options);
  mapView.onCreate(savedInstanceState);
  mapView.getMapAsync(new OnMapReadyCallback() {
    @Override
    public void onMapReady(MapboxMap mapboxMap) {

      // Customize map with markers, polylines, etc.

    }
  });

  setContentView(mapView);
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:30,代码来源:MapboxMapOptionActivity.java

示例3: onCreate

import com.mapbox.mapboxsdk.maps.MapboxMapOptions; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_basic_support_map_frag);

  // Mapbox access token is configured here. This needs to be called either in your application
  // object or in the same activity which contains the mapview.
  Mapbox.getInstance(this, getString(R.string.access_token));

  // Create supportMapFragment
  MapFragment mapFragment;
  if (savedInstanceState == null) {

    // Create fragment
    final FragmentTransaction transaction = getFragmentManager().beginTransaction();

    LatLng patagonia = new LatLng(-52.6885, -70.1395);

    // Build mapboxMap
    MapboxMapOptions options = new MapboxMapOptions();
    options.styleUrl(Style.SATELLITE);
    options.camera(new CameraPosition.Builder()
      .target(patagonia)
      .zoom(9)
      .build());

    // Create map fragment
    mapFragment = MapFragment.newInstance(options);

    // Add map fragment to parent container
    transaction.add(R.id.container, mapFragment, "com.mapbox.map");
    transaction.commit();
  } else {
    mapFragment = (MapFragment) getFragmentManager().findFragmentByTag("com.mapbox.map");
  }

  mapFragment.getMapAsync(new OnMapReadyCallback() {
    @Override
    public void onMapReady(MapboxMap mapboxMap) {

      // Customize map with markers, polylines, etc.

    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:46,代码来源:MapFragmentActivity.java

示例4: onCreate

import com.mapbox.mapboxsdk.maps.MapboxMapOptions; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_basic_support_map_frag);

  // Mapbox access token is configured here. This needs to be called either in your application
  // object or in the same activity which contains the mapview.
  Mapbox.getInstance(this, getString(R.string.access_token));

  // Create supportMapFragment
  SupportMapFragment mapFragment;
  if (savedInstanceState == null) {

    // Create fragment
    final FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();

    LatLng patagonia = new LatLng(-52.6885, -70.1395);

    // Build mapboxMap
    MapboxMapOptions options = new MapboxMapOptions();
    options.styleUrl(Style.SATELLITE);
    options.camera(new CameraPosition.Builder()
      .target(patagonia)
      .zoom(9)
      .build());

    // Create map fragment
    mapFragment = SupportMapFragment.newInstance(options);

    // Add map fragment to parent container
    transaction.add(R.id.container, mapFragment, "com.mapbox.map");
    transaction.commit();
  } else {
    mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentByTag("com.mapbox.map");
  }

  mapFragment.getMapAsync(new OnMapReadyCallback() {
    @Override
    public void onMapReady(MapboxMap mapboxMap) {

      // Customize map with markers, polylines, etc.

    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:46,代码来源:SupportMapFragmentActivity.java

示例5: onCreate

import com.mapbox.mapboxsdk.maps.MapboxMapOptions; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  // Mapbox access token is configured here. This needs to be called either in your application
  // object or in the same activity which contains the mapview.
  Mapbox.getInstance(this, getString(R.string.access_token));

  // This contains the MapView in XML and needs to be called after the access token is configured.
  setContentView(R.layout.activity_inset_map);

  mainMapMapView = findViewById(R.id.main_mapView);
  mainMapMapView.onCreate(savedInstanceState);
  mainMapMapView.getMapAsync(this);

  /* Custom version of the regular Mapbox SupportMapFragment class. A custom one is being built here
  so that the interface call backs can be used in the appropriate places so that the example eventually
  works*/
  CustomSupportMapFragment customSupportMapFragment;
  if (savedInstanceState == null) {

    // Create fragment
    final FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();

    // Build map fragment options
    MapboxMapOptions options = new MapboxMapOptions();
    options.styleUrl("mapbox://styles/mapbox/cj5l80zrp29942rmtg0zctjto");
    options.attributionEnabled(false);
    options.logoEnabled(false);
    options.compassEnabled(false);
    options.scrollGesturesEnabled(false);
    options.tiltGesturesEnabled(false);
    options.rotateGesturesEnabled(false);
    options.camera(new CameraPosition.Builder()
      .target(new LatLng(11.302318, 106.025839))
      .zoom(2)
      .build());

    // Create map fragment and pass through map options
    customSupportMapFragment = CustomSupportMapFragment.newInstance(options);

    // Add fragmentMap fragment to parent container
    transaction.add(R.id.mini_map_fragment_container, customSupportMapFragment, "com.mapbox.fragmentMap");
    transaction.commit();

  } else {
    customSupportMapFragment = (CustomSupportMapFragment)
      getSupportFragmentManager().findFragmentByTag("com.mapbox.fragmentMap");
  }
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:51,代码来源:InsetMapActivity.java

示例6: newInstance

import com.mapbox.mapboxsdk.maps.MapboxMapOptions; //导入依赖的package包/类
/**
 * Creates a CustomSupportMapFragment instance
 *
 * @param mapboxMapOptions The configuration options to be used.
 * @return CustomSupportMapFragment created.
 */
public static CustomSupportMapFragment newInstance(@Nullable MapboxMapOptions mapboxMapOptions) {
  CustomSupportMapFragment mapFragment = new CustomSupportMapFragment();
  mapFragment.setArguments(MapFragmentUtils.createFragmentArgs(mapboxMapOptions));
  return mapFragment;
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:12,代码来源:InsetMapActivity.java


注:本文中的com.mapbox.mapboxsdk.maps.MapboxMapOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。