【问题标题】:Yandex MapKit 3.0. Get center of screen and zoom, getting location on mapYandex MapKit 3.0。获取屏幕中心和缩放,在地图上获取位置
【发布时间】:2019-02-09 19:32:36
【问题描述】:

如何在最新版本的 Yandex mapkit 上构建右键?缩放和位置按钮。我只是创建地图类并感到困惑。文档太少了..

【问题讨论】:

    标签: android geolocation mapkit yandex yandex-maps


    【解决方案1】:
    //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);
            }
        });
    

    【讨论】:

      猜你喜欢
      • 2015-12-18
      • 2015-10-17
      • 2011-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-08
      相关资源
      最近更新 更多