2013-05-21 44 views
3

我是android新手。我一直在試圖將視野應用於我在谷歌地圖中的當前位置。該圖像在iOS中顯示Google地圖上的FOV。在Google地圖中動態繪製多邊形

enter image description here

所以基本上我通過,以使整個FOV一個gradiant增加5個三角形具有不同字母做了類似的事情。

enter image description here

我必須更新根據設備的方位此FOV,所以我刪除這些三角形,重新計算它們並重新添加他們。

for(int i=0; i<5;i++){ 
     if(triangles[i]!=null){ 
      triangles[i].remove(); 
     } 
    //triangles=null; 

     la = mvalues[0]-hang/2; 
     lx = lon+i*Math.sin(Math.toRadians(la))/2775; 
     ly = lat+i*Math.cos(Math.toRadians(la))/2775; 
     ra = mvalues[0]+hang/2; 
     rx = lon+i*Math.sin(Math.toRadians(ra))/2775; 
     ry = lat+i*Math.cos(Math.toRadians(ra))/2775; 

     triangles[i] = map.addPolygon(new PolygonOptions().add(new LatLng(lat,lon), new LatLng(ly,lx), new LatLng(ry,rx)).strokeColor(Color.TRANSPARENT).fillColor(Color.argb(50, 0, 0, 50))); 

    } 

fov總是閃爍,並且總是發生gc_concurrent。是否有可能使其不閃爍?

感謝

回答