设置自定义定位蓝点
自定义Marker标记点,呼吸闪烁的动画
贴出代码,学习高德地图官方demo
// 呼吸动画
if(breatheMarker == null) {
LatLng latLng = new LatLng(latlng.latitude - 0.02, latlng.longitude - 0.02);
breatheMarker = aMap.addMarker(new MarkerOptions().position(latLng).zIndex(1)
.anchor(0.5f,0.5f).icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_circle_64)));
// 中心的marker
breatheMarker_center = aMap.addMarker(new MarkerOptions().position(latLng).zIndex(2)
.anchor(0.5f,0.5f).icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_circle_64)));
}
// 动画执行完成后,默认会保持到最后一帧的状态
AnimationSet animationSet = new AnimationSet(true);
AlphaAnimation alphaAnimation = new AlphaAnimation(0.5f, 0f);
alphaAnimation.setDuration(2000);
// 设置不断重复
alphaAnimation.setRepeatCount(Animation.INFINITE);
ScaleAnimation scaleAnimation = new ScaleAnimation(1, 3.5f, 1, 3.5f);
scaleAnimation.setDuration(2000);
// 设置不断重复
scaleAnimation.setRepeatCount(Animation.INFINITE);
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(scaleAnimation);
animationSet.setInterpolator(new LinearInterpolator());
breatheMarker.setAnimation(animationSet);
breatheMarker.startAnimation();