本文介绍了当通过seekbar改变尺寸时,Google Maps for Android v2上的圆圈闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



 我正在实现一种在Android的Google Map(v2)上显示搜索半径的方法: //用于在用户周围绘制圆的方法
private void drawMapSearchRadius(int radius){
if(mMap!= null){
final LatLng userLatLng = getUserLatLng();
if(mSearchCircle == null){
CircleOptions circleOptions = new CircleOptions();
circleOptions.fillColor(Color.parseColor(#447755ff));
circleOptions.strokeColor(Color.TRANSPARENT);
circleOptions.center(userLatLng);
circleOptions.radius(radius);
mSearchCircle = mMap.addCircle(circleOptions);
} else {
mSearchCircle.setCenter(userLatLng);
mSearchCircle.setRadius(radius);
}
}
}

半径由a SeekBar,像这样(我删除了一些不相关的代码):

  @Override 
public void onProgressChanged(SeekBar seekBar,int progress,boolean fromUser){
final int radius = progress + DEFAULT_MIN_RADIUS;
drawMapSearchRadius(radius);
...

当我滑动SeekBar时,圆的半径按预期变化,但它明显闪烁很多。它看起来和感觉非常糟糕。



有没有人遇到这个错误,可以告诉我我做错了什么,或者我可以做什么更好地限制,或者在最好的情况下,消除圈闪烁?

提前致谢

编辑: 由于Google未知对于修复这样的错误很快,我对修复的希望很小。所以我想我的问题正在改变:这是否有任何解决方法?

解决方案

此已经


I am implementing a way to show a search radius on a Google Map (v2) in Android per this method:

// Method for drawing a circle around the user
private void drawMapSearchRadius(int radius) {
    if(mMap != null) {
        final LatLng userLatLng = getUserLatLng();
        if(mSearchCircle == null){
            CircleOptions circleOptions = new CircleOptions();
            circleOptions.fillColor(Color.parseColor("#447755ff"));
            circleOptions.strokeColor(Color.TRANSPARENT);
            circleOptions.center(userLatLng);
            circleOptions.radius(radius);
            mSearchCircle = mMap.addCircle(circleOptions);
        } else {
            mSearchCircle.setCenter(userLatLng);
            mSearchCircle.setRadius(radius);
        }
    }
}

The radius is determined with a SeekBar, like so (I removed some unrelated code):

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    final int radius = progress + DEFAULT_MIN_RADIUS;
    drawMapSearchRadius(radius);
...

When I slide the SeekBar, the radius of the circle changes as expected, but it is visibly flickering a lot. It looks and feels just very bad.

Did anyone experience this error and could tell me what I did wrong or what I could do better to limit or, in the best case, eliminate the circle flickering?

Thanks in advance

EDIT: Apparently it's a bug existing for over a year already, acknowledged by Google last month.

Since Google is not known for fixing errors like this quickly, I have very little hope for a fix.. So I guess my question is changing to this: Are there any workarounds for the meantime?

解决方案

This issue (5707) has been solved on October 24, 2016

这篇关于当通过seekbar改变尺寸时,Google Maps for Android v2上的圆圈闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 20:05