【发布时间】:2017-09-20 05:58:38
【问题描述】:
我想添加带有动画图标的标记, 但它不起作用。 ios中的google map api,很简单。只需使用具有动画的 imageview 设置图标属性。
GMSMarker *newMarker = [GMSMarker markerWithPosition...];
newMarker.icon = animateImageView;
但在 android 中,使用 BitMapDescriptor 设置图标。 无论如何,我尝试这样,但它不起作用。 只显示了第一张图片。
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));
有什么问题? android 谷歌地图中的动画图标不可能?
【问题讨论】:
-
你要放哪种类型的动画图标?
标签: android google-maps animation google-maps-api-3