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));
有帮助吗?

解决方案

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

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top