I'm trying to use an animated Layout for a Google Maps Marker. However, in Google Documentation they only speak about drawables (Bitmaps). The difficulty is only one part of the Layout is rotating. It means, that I can't convert the Layout into a Bitmap and animate the whole Bitmap.
I read the following topic Using an xml Layout for a Google Map Marker for Android that is really similar to my problem. Then I also read the following topic GIF type animation for marker in google map api ANDROID
According to these topics, my code should be something like that (not sure it works!) :
googleMap.addMarker(new MarkerOptions().position(position)
.title("name")
.icon(BitmapDescriptorFactory.fromBitmap(myfunction())));
private final int ONE_SECONDS = 1000;
public Bitmap myfunction(){
// how to do there ?
}
However, I have some problems:
- How to return a 'animated' Bitmap in the myfunction() ? I mean, how to return a different Bitmap each 100 ms ?
- Is this solution a good way ? Because returning a different Bitmap each 100 ms may use a lot of memory for only one animation (and the animation could be not very fluid)...
Actually, maybe I should forget Google Maps ?
EDIT : I tried the solutions given by andrii-omelchenko however this way isn't good. It consumes so much resources for one animated marker !
I found an application doing what I want : ZENLY. Take a look there : https://youtu.be/0S-W8oSnzr0?t=18s How to do the same marker ?
Thanks in advance for your help.