Frage

I am using Google Maps v2 Android MapView. The marker of the position of the user is a blue circle. I want to change this to my drawable.

Is this possible?

I know I can add markers like this but this doesn't apply to the user his own position:

this.marker = BitmapDescriptorFactory.fromResource(R.drawable.marker);
this.map.addMarker(new MarkerOptions().position(position).title(name)
                .draggable(false).icon(this.marker));
War es hilfreich?

Lösung

Yes you can add your custom marker to show user current location....but you need to calculate the latitude and longitude your self using locationListener and show that location on map as follows:

public void setCurretnLocMarker(loc) {

        LatLng mLatLng=new LatLng(loc.getLatitude(), loc.getLongitude());
        getMap().animateCamera(CameraUpdateFactory.newLatLng(mLatLng));

        getMap().addMarker(new MarkerOptions().position(mLatLng).title(mLatLng.toString()).draggable(false));
    }

Andere Tipps

The way that comes to my mind is that.

1) You have the latlng of the current position ... add marker with custom drawable on it. 2) Disible current location on googlemap.. TO disable it think the call is

mGoogleMapObject.setLocationEnable(false);

Thats it.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top