Ham*_*amy 3 android google-maps overlay
试图在Android程序中制作谷歌地图叠加层.在我的叠加层绘制方法中,我有两种添加引脚的方法.其中一个有效,一个没有.不幸的是,那个不起作用的也是唯一一个能够添加阴影的人!有帮助吗?
@Override
public void draw(android.graphics.Canvas canvas, MapView mapView,
boolean shadow) {
Point po = mapView.getProjection().toPixels(mapView.getMapCenter(),
null);
// This does _not_ work, but I would really like it to!
drawAt(canvas, mapView.getResources().getDrawable(R.drawable.map_marker_v),
po.x, po.y, false);
// This does work, but only does half the job
canvas.drawBitmap(BitmapFactory.decodeResource(mapView.getResources(),
R.drawable.map_marker_v), po.x, po.y, null);
}
Run Code Online (Sandbox Code Playgroud)
编辑:固定类型
我认为你的问题可能只是你没有在drawable中设置界限drawAt().您可以使用手动设置边界Drawable.setBounds(),也可以使用ItemizedOverlay的便捷方法boundCenter()或boundCenterBottom().
我相信第二种方法的工作原因是因为使用解码的Bitmap,您不必指定Drawable的边界.
| 归档时间: |
|
| 查看次数: |
1017 次 |
| 最近记录: |