Reputation: 193
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