문제

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