Skip to content Skip to sidebar Skip to footer

How To Create A Location Arrow Marker With Sensor Bearing In Android Google Maps V2?

I have managed to create an arrow ImageView and get the azimuth from the sensors, after that I rotate the ImageView using setRotation() method of the View class. How I can do this

Solution 1:

I suggest you take a look at the android-maps-utils project from Google.

It contains

  • BubbleIconFactory : Responsible for generating markers
  • RotationLayout : Responsible for rotating the contents of the layout (the marker) by multiples of 90 degrees

This should give you the building blocks you need to display your arrow/marker and give it a certain rotation. You'll probably need to customize the rotationlayout a bit.

Solution 2:

you can use: https://developers.google.com/maps/documentation/android/marker#rotate_a_marker

com.google.android.gms.maps.model.Markermarker= addMapMarker(camera,PrefManager.getCurrentUsername(getActivity()),
            BitmapDescriptorFactory.fromResource(R.drawable.overlay_gps_location_scanner_icon));
marker.setRotation(0);

Post a Comment for "How To Create A Location Arrow Marker With Sensor Bearing In Android Google Maps V2?"