Pregunta

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));
¿Fue útil?

Solución

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));
    }

Otros consejos

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top