【发布时间】:2019-02-09 19:32:36
【问题描述】:
如何在最新版本的 Yandex mapkit 上构建右键?缩放和位置按钮。我只是创建地图类并感到困惑。文档太少了..
【问题讨论】:
标签: android geolocation mapkit yandex yandex-maps
如何在最新版本的 Yandex mapkit 上构建右键?缩放和位置按钮。我只是创建地图类并感到困惑。文档太少了..
【问题讨论】:
标签: android geolocation mapkit yandex yandex-maps
//Your location. Point class
//for example: Point(53.0101, 53.0101);
private Point DRIVER_POSITION = new Point(float, float);
....
userLocationLayer = mapView.getMap().getUserLocationLayer();
userLocationLayer.setEnabled(true);
userLocationLayer.setHeadingEnabled(true);
userLocationLayer.setObjectListener(this);
.....
//onClick events. FAB Button's
.....
zoomUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mapView.getMap().move(new CameraPosition(mapView.getMap().getCameraPosition().getTarget(),
mapView.getMap().getCameraPosition().getZoom()+1, 0.0f, 0.0f),
new Animation(Animation.Type.SMOOTH, 1),
null);
}
});
zoomDown.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mapView.getMap().move(new CameraPosition(mapView.getMap().getCameraPosition().getTarget(),
mapView.getMap().getCameraPosition().getZoom()-1, 0.0f, 0.0f),
new Animation(Animation.Type.SMOOTH, 1),
null);
}
});
positionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mapView.getMap().move(
new CameraPosition(userLocationLayer.cameraPosition().getTarget(), 15.0f, 0.0f, 0.0f),
new Animation(Animation.Type.SMOOTH, 1),
null);
}
});
【讨论】: