0

지도에 마커 humanMarker가 있습니다. 사용자가 움직일 때 움직이는 방법?인간의 마커를 어떻게 움직일 수 있습니까?

private Marker humanMarker; 

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

답변

1

onLocationChanged 메서드를 무시합니다. humanMarker은 사용자의 위치가 변경되면 이동합니다.

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