0

I want add marker with animation icon, but It doesn't work. Google map api in ios, it's simple. just set icon property with imageview that have animation.

GMSMarker *newMarker = [GMSMarker markerWithPosition...];
newMarker.icon = animateImageView;

but in android, set icon with BitMapDescriptor. anyway, I try like this, but it doesn't work. just first image showed.

ImageView animImgView = new ImagView(context);
//walking_person_anim.xml - <animation-list>...</animation-list> 
animImgView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.walking_person_anim));

animImgView.measure(...,...);
Bitmap markerBitmap = Bitmap.createBitmap(..., .., Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(markerBitmap);

AnimationDrawable ad = (AnimationDrawable) anim.getDrawable();
ad.setBound(0,0,...,...);
ad.draw(markerBitmap);
ad.start();

googleMap.addMarker(new MarkerOptions().position(...)
.icon(BitmapDescriptorFactory.fromBitmap(markerBitmap));

what's problem? animation icon impossible in android google map?

임근영
  • 193
  • 1
  • 3
  • 14

1 Answers1

2

Hope you will get a better solution from here.

On that link there is a question to how to Animating markers on Google Maps V2

Mafujul
  • 1,090
  • 10
  • 15