以下提供主要代码和思路:
1.根据传过来的经纬度,来标记:
LatLng latLng = new LatLng(Double.parseDouble("经度"),Double.parseDouble("维度"));
BitmapDescriptor bd = BitmapDescriptorFactory.fromResource(R.drawable.entertainment_logo);
OverlayOptions ooB = new MarkerOptions().position(latLng ).icon(bd);
mBaiduMap.addOverlay(ooB);
MapStatusUpdate mud=MapStatusUpdateFactory.newLatLng(friends_ll);
mBaiduMap.animateMapStatus(mud);
BitmapDescriptor bd = BitmapDescriptorFactory.fromResource(R.drawable.entertainment_logo);
OverlayOptions ooB = new MarkerOptions().position("经纬度").icon(bd);
mBaiduMap.clear();
mBaiduMap.addOverlay(ooB);
MapStatusUpdate mud=MapStatusUpdateFactory.newLatLng(friends_ll);
mBaiduMap.animateMapStatus(mud);
mBaiduMap.snapshotScope(rect, snapshotReadyCallback);
snapshotReadyCallback=new SnapshotReadyCallback(){
@Override
public void onSnapshotReady(Bitmap bitmap) {
File file=new File(filename);
try {
FileOutputStream fileOutputStream=new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.PNG, 90, fileOutputStream);
fileOutputStream.flush();
fileOutputStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
};
Uri uri=Uri.fromFile(new File(filename));
Bitmap bitmap = decodeUriAsBitmap(uri);
xxx_map.setImageBitmap(bitmap);
5.百度地图接口网址:http://wiki.lbsyun.baidu.com/cms/androidsdk/doc/v3_6_1/
public static interface BaiduMap.SnapshotReadyCallback
void onSnapshotReady(Bitmap snapshot)
snapshot
- 截屏返回的 bitmap 数据