在 MapView 上的特定 GeoPoint 处绘制 ImageView (Android)
尝试解决我在 Android MapView 上绘制图像的当前问题,然后为了使其动画化以表示移动的对象,我决定尝试在地图上的 GeoPoint 处绘制原始 ImageView,然后尝试从那里对其进行动画处理。
这是我放入地图活动(扩展 MapActivity)的 onCreate 方法中的代码:
GeoPoint point = new GeoPoint(19240000, -99120000);
ImageView iv = new ImageView(this);
iv.setImageResource(R.drawable.icon);
LayoutParams lp = new LayoutParams(iv.getWidth(), iv.getHeight(), point, LayoutParams.BOTTOM);
mapView.addView(iv, lp);
同样,我只是尝试绘制静态图标并从那里为其设置动画。我已经可以使用 ItemizedOverlay 来做到这一点,但据我所知,我无法像对视图进行动画处理那样对 AnimatedOverlay 的元素进行动画处理。因此,使用ImageView。
但图标不显示。有什么想法或建议吗?
Trying to solve my current problem of drawing an image on an Android MapView and then animate it to represent a moving object, I decided to try to just draw a raw ImageView at a GeoPoint on the map and then try and animate it from there.
This is the code I put in my map activity (extends MapActivity)'s onCreate method:
GeoPoint point = new GeoPoint(19240000, -99120000);
ImageView iv = new ImageView(this);
iv.setImageResource(R.drawable.icon);
LayoutParams lp = new LayoutParams(iv.getWidth(), iv.getHeight(), point, LayoutParams.BOTTOM);
mapView.addView(iv, lp);
Again, I'm just trying to draw the static icon and animate it from there. I can already do this with an ItemizedOverlay, but as far as I can tell, I can't animate the elements of an AnimatedOverlay the way that I can animate a view. Thus, using ImageView.
But the icon doesn't show up. Any thoughts or suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过使用 WRAP_CONTENT 标签?
Have you tried with the WRAP_CONTENT tags?