marker的remove()方法如何移除原来位置的标注?
//地图标注
private void initMark() {
//定义Maker坐标点
LatLng point = new LatLng(39.963175, 116.400244);
//构建Marker图标
BitmapDescriptor bitmap = BitmapDescriptorFactory
.fromResource(R.drawable.icon_marka);
OverlayOptions option = new MarkerOptions()
.position(point)
.icon(bitmap);
//构建MarkerOption,用于在地图上添加Marker
OverlayOptions options = new MarkerOptions()
.position(point) //设置marker的位置
.icon(bitmap) //设置marker图标
.zIndex(9) //设置marker所在层级
.draggable(true); //设置手势拖拽
//在地图上添加Marker,并显示
mBaiduMap.addOverlay(option);
marker = (Marker) (mBaiduMap.addOverlay(options));
//调用BaiduMap对象的setOnMarkerDragListener方法设置marker拖拽的监听
mBaiduMap.setOnMarkerDragListener(new BaiduMap.OnMarkerDragListener() {
public void onMarkerDrag(Marker marker) {
//拖拽中
log("拖拽中");
}
public void onMarkerDragEnd(Marker marker) {
//拖拽结束
log("拖拽结束");
}
public void onMarkerDragStart(Marker marker) {
//开始拖拽
log("开始拖拽");
}
});
}
Tell me your own way, set your icon in the center of your layout file
The icon does not move and is always at the center of the current scene. Baidu Map can be moved
mBaiduMap.addOverlay(option);
marker = (Marker) (mBaiduMap.addOverlay(options));
I created it repeatedly