【问题标题】:How to make the human marker move on the map?如何使人类标记在地图上移动?
【发布时间】:2017-10-20 12:28:13
【问题描述】:

我在地图上有一个标记 humanMarker。当用户移动时如何让它移动?

private Marker humanMarker;

humanMarker = map.addMarker(new MarkerOptions()
                .position(new LatLng(mLocation.getLatitude(), mLocation.getLongitude()))
                .icon(BitmapDescriptorFactory.fromResource(R.drawable.human)));

【问题讨论】:

    标签: java android google-maps google-maps-android-api-2 marker


    【解决方案1】:

    尝试覆盖onLocationChanged 方法。 humanMarker 将在用户位置改变时移动。

    @Override
    public void onLocationChanged(Location location) {
        // Update current location of the marker
        humanMarker.setPosition(new LatLng(location.getLatitude(), location.getLongitude()));
    }
    

    【讨论】:

      猜你喜欢
      • 2017-12-29
      • 2013-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-08
      • 2013-09-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多