private AMap aMap;
private int minRadius = 100;
private int maxRadius = 250;
private int radius = minRadius;
private int gap = 8;
private int duration = 16;
private List<Circle> listCircle = new ArrayList<>();
/*雷达*/
private void showRadar() {
if (longClickLatlng != null) {
/*Projection projection = aMap.getProjection();
Point point = projection.toScreenLocation(longClickLatlng);*/
clearCircle();
// 绘制一个圆形 50-200
final Circle circle = aMap.addCircle(new CircleOptions().center(longClickLatlng)
.radius(radius).strokeColor(Color.argb(100, 100, 149, 237))
.fillColor(Color.argb(100, 135, 206, 250)).strokeWidth(3));
final Circle circle1 = aMap.addCircle(new CircleOptions().center(longClickLatlng)
.radius(radius-50).strokeColor(Color.argb(100, 100, 149, 237))
.fillColor(Color.argb(0, 135, 206, 250)).strokeWidth(3));
final Circle circle2 = aMap.addCircle(new CircleOptions().center(longClickLatlng)
.radius(radius-100).strokeColor(Color.argb(100, 100, 149, 237))
.fillColor(Color.argb(0, 135, 206, 250)).strokeWidth(3));
listCircle.add(circle);
listCircle.add(circle1);
listCircle.add(circle2);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (radius < maxRadius) {
radius = radius + gap;
} else {
radius = minRadius;
}
circle.setRadius(radius);
circle1.setRadius(radius-50);
circle2.setRadius(radius-100);
aMap.invalidate();
if (isMapLongCLick)
handler.postDelayed(this, duration);
else
clearCircle();
}
}, duration);
}
}
private void clearCircle() {
for (int i = 0; i < listCircle.size(); i++) {
listCircle.get(i).remove();
listCircle.remove(i);
}
}
作者:u010378579 发表于2017/3/14 18:09:44 原文链接
阅读:20 评论:0 查看评论