【问题标题】:Animate the Mapbox Camera in v10v10 中的 Mapbox 相机动画
【发布时间】:2021-11-08 01:44:55
【问题描述】:

在 mapbox v9 中,我可以使用 animatecamera 方法为相机设置动画。

在 mapbox v10 中,它说使用 flyToeaseTo。然而这些方法都不存在于 mapboxMap 对象中?

mapView = findViewById(R.id.mapView)
mapboxMap = mapView.getMapboxMap()
mapboxMap.flyTo();  //Method not found??

抱歉,我不熟悉 Kotlin,所以这个问题是针对基于 Java 的解决方案。

Mapbox 帮助部分:

https://docs.mapbox.com/android/maps/guides/migrate-to-v10/

【问题讨论】:

标签: java android mapbox mapbox-android


【解决方案1】:

在其他地方收到了答案。在java中动画相机的正确方法如下:

final Cancelable cancelable = CameraAnimationsUtils.easeTo(mapView.getMapboxMap(), new CameraOptions.Builder().zoom(5.0).build(), new MapAnimationOptions.Builder().duration(4000).build());

// or to get actual object of animation plugin and call functions directly with it

final CameraAnimationsPlugin camera = CameraAnimationsUtils.getCamera(mapView);
final Cancelable cancelable = camera.easeTo(
        new CameraOptions.Builder().zoom(5.0).build(),
        new MapAnimationOptions.Builder().duration(4000).build()
);

【讨论】:

  • 你从哪里得到这个答案的?我也不熟悉 kotlin。我被困在如何禁用地图上的手势上。你知道如何在 java 上做到这一点吗?
  • @karatuno 是的,我可以帮你解决这个问题,你可以提出一个问题,我会为你发布答案。
猜你喜欢
  • 2022-07-08
  • 2022-10-21
  • 2023-02-23
  • 1970-01-01
  • 2021-12-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多