임근영
임근영

Reputation: 193

Is it possible add animation icon marker on Google map android api?

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?

Upvotes: 0

Views: 2050

Answers (1)

Mafujul
Mafujul

Reputation: 1100

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

Upvotes: 2

Related Questions