大家好我想在eclipse中只在地图上绘制3个圆圈,但是使用for循环绘制一个特定数量的圆圈,我会在我的代码中看到循环语句,但不能正常工作
这是我的代码,我可以在哪里编写for循环语句,以便工作得很好? 请帮忙 谢谢......
public class Map extends Activity implements OnMapClickListener
{
final int RQS_GooglePlayServices = 1;
private GoogleMap myMap;
Circle myCircle;
@Override
protected void onCreate(Bundle savedInstanceState) {
//TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
FragmentManager myFragmentManager = getFragmentManager();
MapFragment myMapFragment = (MapFragment)myFragmentManager.findFragmentById(R.id.map);
myMap = myMapFragment.getMap();
myMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
myMap.setOnMapClickListener(this);
myMap.setMyLocationEnabled(true);
myMap.setBuildingsEnabled(true);
}
@Override
public void onMapClick(LatLng point) {
int z =3;
CircleOptions circleOptions = new CircleOptions()
.center(point) //set center
.radius(500) //set radius in meters
.fillColor(Color.TRANSPARENT) //default
.strokeColor(Color.BLUE)
.strokeWidth(5);
for(int circle = 0 ; z > circle ; z--){
myCircle = myMap.addCircle(circleOptions);
}
}
}
答案 0 :(得分:0)
为什么不使用
for(int circle = 0; circle < z; circle++)
for for-loop?