Reputation: 9894
I have some pin graphic for my markers, but i have to rotate them. I googled alot but just coudnt find the solution.
Is there anybody know how could i achive this somehow ?
BitmapDescriptor does not have any functions like this, nor have MarkerOptions or Marker itself.
Please suggest me some ways.
Upvotes: 2
Views: 5499
Reputation: 2421
Have you tried marker.rotation(float value)
?
take a look at https://developers.google.com/maps/documentation/android/marker#flatten_a_marker
Upvotes: 5
Reputation:
In a new maps api (revision 7 of API v2) new method called setIcon (BitmapDescriptor icon)
was added you can try it after update - it must work flawlessly.
https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Marker#setIcon%28com.google.android.gms.maps.model.BitmapDescriptor%29
But if you don't want to update then the only way to do this is changing marker icon at runtime (dynamically) but as was said here https://developers.google.com/maps/documentation/android/marker: You can't change the icon once you've created the marker
. So the only way is dynamically recreate marker.This is a bad solution because recreating markers takes a lot of memory allocation so it results in garbage collection and performance drawbacks. In order to avoid this create all your marker bitmaps and add all of them to the map at once. After that you can use Marker.setVisible(boolean)
function to display the one that you currently need.
Upvotes: 3