|
android开发之百度地图marker点添加,删除,动画等操作实例 [Java] [color=rgb(51, 102, 153) !important]查看源文件 [color=rgb(51, 102, 153) !important]复制代码
[color=rgb(160, 160, 160) !important][color=#a0a0a0 !important]?
| LatLng point = new LatLng(markx,marky);//坐标参数(纬度,经度)
BitmapDescriptor bitmap = BitmapDescriptorFactory
.fromResource(R.mipmap.drone);//自定义marker点图片
|
[Java] [color=rgb(51, 102, 153) !important]查看源文件 [color=rgb(51, 102, 153) !important]复制代码
[color=rgb(160, 160, 160) !important][color=#a0a0a0 !important]?
| //构建MarkerOption,用于在地图上添加Marker
OverlayOptions option = new MarkerOptions()
.position(point)
.icon(bitmap);
|
[Java] [color=rgb(51, 102, 153) !important]查看源文件 [color=rgb(51, 102, 153) !important]复制代码
[color=rgb(160, 160, 160) !important][color=#a0a0a0 !important]?
| marker = (Marker) map.addOverlay(option);//将marker添加到地图,并获取该marker点对象
|
marker.remove();//删除 [Java] [color=rgb(51, 102, 153) !important]查看源文件 [color=rgb(51, 102, 153) !important]复制代码
[color=rgb(160, 160, 160) !important][color=#a0a0a0 !important]?
| AlphaAnimation animation = new AlphaAnimation(1.0f,0.0f);//marker点动画(需导入百度地图的Animation包)
animation.setDuration(3000);
marker.setAnimation(animation);
marker.startAnimation();
|
[Java] [color=rgb(51, 102, 153) !important]查看源文件 [color=rgb(51, 102, 153) !important]复制代码
[color=rgb(160, 160, 160) !important][color=#a0a0a0 !important]?
| OverlayOptions ooCircle = new CircleOptions().fillColor(R.color.colorAccent)//地图上已point为中心添加圆
.center(point).stroke(new Stroke(5, R.color.colorPrimary)).radius(1400);
|
|
|