jet*_*hro 9 android google-maps-android-api-2
在这种情况下,我想在Google地图上使用绘制位图gms v2,每个用户位置更新都会强制执行位图更新.目前我使用以下代码段:
public void init(){
result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
canvas = new Canvas(result);
}
public void update(){
// draw on canvas ...
draw(result);
}
public void draw(Bitmap modifiedBmp) {
if (overlay != null) {
overlay.remove();
}
BitmapDescriptor descriptor = BitmapDescriptorFactory.fromBitmap(modifiedBmp);
overlay = map.addGroundOverlay(new GroundOverlayOptions().image(descriptor).positionFromBounds(bounds).zIndex(100));
}
Run Code Online (Sandbox Code Playgroud)
update()每秒调用该方法.我发现这种方法非常低效,我正在寻找更好的解决方案(即每次更新后不需要添加/删除叠加).使用addPolygon(...)和addPolyline(...)不是选项在地图上绘制图元,因为我需要标准API中不存在的绘图功能.
| 归档时间: |
|
| 查看次数: |
4639 次 |
| 最近记录: |