在Android上谷歌地图上的圆圈animation

使用价值animation谷歌地图上做圆圈animation,但animation一直闪烁闪烁。

这里是一个代码,

CircleOptions circleOptions = new CircleOptions() .center(searchStopPoint) //set center .radius(100) //set radius in meters .strokeColor(Color.TRANSPARENT) .fillColor(0x555751FF) .strokeWidth(5); busStopCircle = googleMap.addCircle(circleOptions); ValueAnimator valueAnimator = new ValueAnimator(); valueAnimator.setRepeatCount(ValueAnimator.INFINITE); valueAnimator.setRepeatMode(ValueAnimator.RESTART); valueAnimator.setIntValues(0, 100); valueAnimator.setDuration(3000); valueAnimator.setEvaluator(new IntEvaluator()); valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { float animatedFraction = valueAnimator.getAnimatedFraction(); busStopCircle.setRadius(animatedFraction * 100); } }); valueAnimator.start(); 

任何人都可以帮助我使它平滑的animation没有闪烁..

谢谢

Solutions Collecting From Web of "在Android上谷歌地图上的圆圈animation"

这是一个已知的问题 。 一种解决方法是使用GroundOverlay而不是一个圆。
这是一个示例:
创build圈子:

 // The drawable to use for the circle GradientDrawable d = new GradientDrawable(); d.setShape(GradientDrawable.OVAL); d.setSize(500,500); d.setColor(0x555751FF); d.setStroke(5, Color.TRANSPARENT); Bitmap bitmap = Bitmap.createBitmap(d.getIntrinsicWidth() , d.getIntrinsicHeight() , Bitmap.Config.ARGB_8888); // Convert the drawable to bitmap Canvas canvas = new Canvas(bitmap); d.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); d.draw(canvas); // Radius of the circle final int radius = 100; // Add the circle to the map final GroundOverlay circle = map.addGroundOverlay(new GroundOverlayOptions() .position(searchStopPoint, 2 * radius).image(BitmapDescriptorFactory.fromBitmap(bitmap))); 

现在改变你的animation师:

 ValueAnimator valueAnimator = new ValueAnimator(); valueAnimator.setRepeatCount(ValueAnimator.INFINITE); valueAnimator.setRepeatMode(ValueAnimator.RESTART); valueAnimator.setIntValues(0, radius); valueAnimator.setDuration(3000); valueAnimator.setEvaluator(new IntEvaluator()); valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { float animatedFraction = valueAnimator.getAnimatedFraction(); circle.setDimensions(animatedFraction * radius * 2); } }); valueAnimator.start(); 

更新 :这个问题已经修复